From 3783674263dce1791c090b3a3c8dd40458cc17a1 Mon Sep 17 00:00:00 2001 From: jbond Date: Thu, 29 Aug 2024 19:56:44 +0200 Subject: [PATCH] conf_d: merge the unbound_conf_d and conf_d params AFAICT the intention of theses two parameters is the same so lets merge them fixes #342 --- data/os/Debian.yaml | 3 ++- manifests/init.pp | 14 ++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/data/os/Debian.yaml b/data/os/Debian.yaml index 0d12ba3d..1cadb602 100644 --- a/data/os/Debian.yaml +++ b/data/os/Debian.yaml @@ -1,4 +1,5 @@ --- unbound::pidfile: '/run/unbound.pid' unbound::runtime_dir: '/var/lib/unbound' -unbound::purge_unbound_conf_d: true +unbound::conf_d: "%{confdir}/unbound.conf.d" +unbound::purge_conf_d: true diff --git a/manifests/init.pp b/manifests/init.pp index 3952a770..1c6a5fce 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -181,7 +181,7 @@ # OpenBSD sets this to an empty string Variant[String,Array] $package_name = 'unbound', String[1] $package_ensure = 'installed', - Boolean $purge_unbound_conf_d = false, + Boolean $purge_conf_d = false, String[1] $root_hints_url = 'https://www.internic.net/domain/named.root', Stdlib::Absolutepath $runtime_dir = $confdir, Stdlib::Absolutepath $auto_trust_anchor_file = "${runtime_dir}/root.key", @@ -218,14 +218,13 @@ String[1] $redis_server_host = '127.0.0.1', Integer[1,65536] $redis_server_port = 6379, Integer[1] $redis_timeout = 100, - Stdlib::Absolutepath $unbound_conf_d = "${confdir}/unbound.conf.d", Unbound::Hints_file $hints_file = "${confdir}/root.hints", Enum['absent','present','unmanaged'] $update_root_hints = fact('systemd') ? { true => 'present', default => 'unmanaged' }, Optional[String[1]] $hints_file_content = undef, Hash[String[1], Unbound::Rpz] $rpzs = {}, Optional[String[1]] $unbound_version = $facts['unbound_version'], ) { - $_base_dirs = [$confdir, $conf_d, $keys_d, $runtime_dir] + $_base_dirs = [$confdir, $keys_d, $runtime_dir] $_piddir = if $pidfile { dirname($pidfile) } else { undef } if $_piddir and !($_piddir in ['/run', '/var/run']) { $dirs = unique($_base_dirs + [$_piddir]) @@ -345,12 +344,11 @@ } # purge unmanaged files in configuration directory - file { $unbound_conf_d: + file { $conf_d: ensure => 'directory', - owner => 'root', - group => '0', - purge => $purge_unbound_conf_d, - recurse => $purge_unbound_conf_d, + owner => $owner, + purge => $purge_conf_d, + recurse => $purge_conf_d, } concat { $config_file: