Skip to content

Commit

Permalink
conf_d: merge the unbound_conf_d and conf_d params
Browse files Browse the repository at this point in the history
AFAICT the intention of theses two parameters is the same so lets merge
them

fixes voxpupuli#342
  • Loading branch information
b4ldr committed Nov 21, 2024
1 parent 737a023 commit 3f66b62
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 29 deletions.
27 changes: 9 additions & 18 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ 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)
* [`root_hints_url`](#-unbound--root_hints_url)
* [`runtime_dir`](#-unbound--runtime_dir)
* [`auto_trust_anchor_file`](#-unbound--auto_trust_anchor_file)
Expand Down Expand Up @@ -244,12 +243,12 @@ 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)
* [`rpzs`](#-unbound--rpzs)
* [`unbound_version`](#-unbound--unbound_version)
* [`purge_conf_d`](#-unbound--purge_conf_d)

##### <a name="-unbound--manage_service"></a>`manage_service`

Expand Down Expand Up @@ -1571,14 +1570,6 @@ the ensure value for the packages

Default value: `'installed'`

##### <a name="-unbound--purge_unbound_conf_d"></a>`purge_unbound_conf_d`

Data type: `Boolean`

if true all unmanaged files in $unbound_conf_d will be purged

Default value: `false`

##### <a name="-unbound--root_hints_url"></a>`root_hints_url`

Data type: `String[1]`
Expand Down Expand Up @@ -1867,14 +1858,6 @@ see https://nlnetlabs.nl/documentation/unbound/unbound.conf/

Default value: `100`

##### <a name="-unbound--unbound_conf_d"></a>`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"`

##### <a name="-unbound--hints_file"></a>`hints_file`

Data type: `Unbound::Hints_file`
Expand Down Expand Up @@ -1916,6 +1899,14 @@ specifying reduces the number of puppet runs

Default value: `$facts['unbound_version']`

##### <a name="-unbound--purge_conf_d"></a>`purge_conf_d`

Data type: `Boolean`



Default value: `false`

### <a name="unbound--remote"></a>`unbound::remote`

Configure remote control of the unbound daemon process
Expand Down
3 changes: 2 additions & 1 deletion data/os/Debian.yaml
Original file line number Diff line number Diff line change
@@ -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
16 changes: 6 additions & 10 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@
# @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 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/
Expand Down Expand Up @@ -203,7 +202,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
Expand Down Expand Up @@ -377,7 +375,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",
Expand Down Expand Up @@ -414,14 +412,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])
Expand Down Expand Up @@ -541,12 +538,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:
Expand Down

0 comments on commit 3f66b62

Please sign in to comment.