diff --git a/REFERENCE.md b/REFERENCE.md
index ee0f90c..1ba8490 100644
--- a/REFERENCE.md
+++ b/REFERENCE.md
@@ -207,7 +207,7 @@ The following parameters are available in the `unbound` class:
* [`username`](#-unbound--username)
* [`package_name`](#-unbound--package_name)
* [`package_ensure`](#-unbound--package_ensure)
-* [`purge_unbound_conf_d`](#-unbound--purge_unbound_conf_d)
+* [`purge_conf_d`](#-unbound--purge_conf_d)
* [`root_hints_url`](#-unbound--root_hints_url)
* [`runtime_dir`](#-unbound--runtime_dir)
* [`auto_trust_anchor_file`](#-unbound--auto_trust_anchor_file)
@@ -244,7 +244,6 @@ The following parameters are available in the `unbound` class:
* [`redis_server_host`](#-unbound--redis_server_host)
* [`redis_server_port`](#-unbound--redis_server_port)
* [`redis_timeout`](#-unbound--redis_timeout)
-* [`unbound_conf_d`](#-unbound--unbound_conf_d)
* [`hints_file`](#-unbound--hints_file)
* [`update_root_hints`](#-unbound--update_root_hints)
* [`hints_file_content`](#-unbound--hints_file_content)
@@ -1571,11 +1570,11 @@ the ensure value for the packages
Default value: `'installed'`
-##### `purge_unbound_conf_d`
+##### `purge_conf_d`
Data type: `Boolean`
-if true all unmanaged files in $unbound_conf_d will be purged
+if true purge all unmanaged files in conf_d folder
Default value: `false`
@@ -1867,14 +1866,6 @@ see https://nlnetlabs.nl/documentation/unbound/unbound.conf/
Default value: `100`
-##### `unbound_conf_d`
-
-Data type: `Stdlib::Absolutepath`
-
-similar to conf_d, will be merged with conf_d version in future
-
-Default value: `"${confdir}/unbound.conf.d"`
-
##### `hints_file`
Data type: `Unbound::Hints_file`
diff --git a/data/os/Debian.yaml b/data/os/Debian.yaml
index 0d12ba3..4ef5f46 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: "/etc/unbound/unbound.conf.d"
+unbound::purge_conf_d: true
diff --git a/manifests/init.pp b/manifests/init.pp
index 60fdb6a..5691a23 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -166,7 +166,7 @@
# @param username see https://nlnetlabs.nl/documentation/unbound/unbound.conf/
# @param package_name The package(s) to install to get unbound
# @param package_ensure the ensure value for the packages
-# @param purge_unbound_conf_d if true all unmanaged files in $unbound_conf_d will be purged
+# @param purge_conf_d if true purge all unmanaged files in conf_d folder
# @param root_hints_url the url to download the root hints file
# @param runtime_dir the runtime directory used
# @param auto_trust_anchor_file see https://nlnetlabs.nl/documentation/unbound/unbound.conf/
@@ -203,7 +203,6 @@
# @param redis_server_host see https://nlnetlabs.nl/documentation/unbound/unbound.conf/
# @param redis_server_port see https://nlnetlabs.nl/documentation/unbound/unbound.conf/
# @param redis_timeout see https://nlnetlabs.nl/documentation/unbound/unbound.conf/
-# @param unbound_conf_d similar to conf_d, will be merged with conf_d version in future
# @param hints_file the root hints file to use
# @param update_root_hints f we should update the root hints file
# @param hints_file_content the contents of the root hints file
@@ -377,7 +376,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",
@@ -414,14 +413,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])
@@ -541,12 +539,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:
diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb
index abd5d4b..f388024 100644
--- a/spec/classes/init_spec.rb
+++ b/spec/classes/init_spec.rb
@@ -9,12 +9,10 @@
on_supported_os.each do |os, facts|
context "on #{os}" do
let(:facts) { facts.merge(concat_basedir: '/dne') }
- let(:package) { 'unbound' }
let(:conf_file) { "#{conf_dir}/unbound.conf" }
- let(:conf_d_dir) { "#{conf_dir}/conf.d" }
- let(:unbound_conf_d) { "#{conf_dir}/unbound.conf.d" }
let(:keys_d_dir) { "#{conf_dir}/keys.d" }
let(:hints_file) { "#{conf_dir}/root.hints" }
+ let(:package) { 'unbound' }
pidfile = nil
@@ -23,33 +21,44 @@
pidfile = '/run/unbound.pid'
let(:service) { 'unbound' }
let(:conf_dir) { '/etc/unbound' }
- let(:purge_unbound_conf_d) { true }
+ let(:purge_conf_d) { true }
let(:control_path) { '/usr/sbin/unbound-control' }
when 'OpenBSD'
pidfile = '/var/run/unbound.pid'
let(:service) { 'unbound' }
let(:conf_dir) { '/var/unbound/etc' }
- let(:purge_unbound_conf_d) { false }
+ let(:purge_conf_d) { false }
let(:control_path) { '/usr/sbin/unbound-control' }
when 'FreeBSD'
pidfile = '/usr/local/etc/unbound/unbound.pid'
let(:service) { 'unbound' }
let(:conf_dir) { '/usr/local/etc/unbound' }
- let(:purge_unbound_conf_d) { false }
+ let(:purge_conf_d) { false }
let(:control_path) { '/usr/local/sbin/unbound-control' }
when 'Darwin'
pidfile = '/var/run/unbound.pid'
let(:service) { 'org.macports.unbound' }
let(:conf_dir) { '/opt/local//etc/unbound' }
- let(:purge_unbound_conf_d) { false }
+ let(:purge_conf_d) { false }
else
pidfile = '/var/run/unbound/unbound.pid'
let(:service) { 'unbound' }
let(:conf_dir) { '/etc/unbound' }
- let(:purge_unbound_conf_d) { false }
+ let(:purge_conf_d) { false }
let(:control_path) { '/usr/sbin/unbound-control' }
end
+ if facts[:os]['family'] == 'Archlinux'
+ let(:owner) { 'root' }
+ else
+ let(:owner) { 'unbound' }
+ end
+ if facts[:os]['family'] == 'Debian'
+ let(:conf_d_dir) { "#{conf_dir}/unbound.conf.d" }
+ else
+ let(:conf_d_dir) { "#{conf_dir}/conf.d" }
+ end
+
context 'with default params' do
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_class('unbound') }
@@ -58,7 +67,6 @@
it { is_expected.to contain_service(service) }
it { is_expected.to contain_concat(conf_file) }
it { is_expected.to contain_file(conf_dir) }
- it { is_expected.to contain_file(conf_d_dir) }
it { is_expected.to contain_file(keys_d_dir) }
it { is_expected.to contain_file(hints_file) }
@@ -67,12 +75,11 @@
end
it do
- expect(subject).to contain_file(unbound_conf_d).with(
+ expect(subject).to contain_file(conf_d_dir).with(
'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
)
end