Put confdir in the params class, and more..

Fix a bunch of warnings whne using the bind::updater class by moving confdir to
the params class. In order for this to work, the bind and bind::updater classes
both now inherit from params. Also, fix the default value for
managed_key_directory to something that's actually falsey.
This commit is contained in:
Nate Riffe 2015-12-26 00:58:02 -06:00
parent 1af06cbd88
commit 250cb4e4c6
7 changed files with 17 additions and 21 deletions

View File

@ -5,8 +5,8 @@ bind::params::bind_group: 'bind'
bind::params::bind_package: 'bind9' bind::params::bind_package: 'bind9'
bind::params::bind_service: 'bind9' bind::params::bind_service: 'bind9'
bind::params::nsupdate_package: 'dnsutils' bind::params::nsupdate_package: 'dnsutils'
bind::params::confdir: '/etc/bind'
bind::namedconf: '/etc/bind/named.conf' bind::namedconf: '/etc/bind/named.conf'
bind::confdir: '/etc/bind'
bind::cachedir: '/var/cache/bind' bind::cachedir: '/var/cache/bind'
bind::rndc: true bind::rndc: true

View File

@ -6,8 +6,8 @@ bind::params::bind_package: 'bind'
bind::params::bind_service: 'named' bind::params::bind_service: 'named'
bind::params::nsupdate_package: 'bind-utils' bind::params::nsupdate_package: 'bind-utils'
bind::params::managed_keys_directory: '/var/named/dynamic' bind::params::managed_keys_directory: '/var/named/dynamic'
bind::params::confdir: '/etc/named'
bind::namedconf: '/etc/named.conf' bind::namedconf: '/etc/named.conf'
bind::confdir: '/etc/named'
bind::cachedir: '/var/named' bind::cachedir: '/var/named'
bind::rndc: true bind::rndc: true

View File

@ -1,7 +1,6 @@
# ex: syntax=puppet si ts=4 sw=4 et # ex: syntax=puppet si ts=4 sw=4 et
class bind ( class bind (
$confdir = undef,
$namedconf = undef, $namedconf = undef,
$cachedir = undef, $cachedir = undef,
$forwarders = undef, $forwarders = undef,
@ -11,18 +10,13 @@ class bind (
$statistics_port = undef, $statistics_port = undef,
$random_device = undef, $random_device = undef,
$include_local = undef, $include_local = undef,
) { ) inherits bind::params {
include ::bind::params
# Re-scope members of bind::params for templating
$managed_keys_directory = $::bind::params::managed_keys_directory
$auth_nxdomain = false $auth_nxdomain = false
File { File {
ensure => present, ensure => present,
owner => 'root', owner => 'root',
group => $::bind::params::bind_group, group => $bind_group,
mode => '0644', mode => '0644',
require => Package['bind'], require => Package['bind'],
notify => Service['bind'], notify => Service['bind'],
@ -30,13 +24,13 @@ class bind (
package{'bind-tools': package{'bind-tools':
ensure => latest, ensure => latest,
name => $::bind::params::nsupdate_package, name => $nsupdate_package,
before => Package['bind'], before => Package['bind'],
} }
package { 'bind': package { 'bind':
ensure => latest, ensure => latest,
name => $::bind::params::bind_package, name => $bind_package,
} }
if $dnssec { if $dnssec {
@ -79,7 +73,7 @@ class bind (
"${confdir}/views.conf", "${confdir}/views.conf",
]: ]:
owner => 'root', owner => 'root',
group => $::bind::params::bind_group, group => $bind_group,
mode => '0644', mode => '0644',
require => Package['bind'], require => Package['bind'],
notify => Service['bind'], notify => Service['bind'],
@ -105,7 +99,7 @@ class bind (
service { 'bind': service { 'bind':
ensure => running, ensure => running,
name => $::bind::params::bind_service, name => $bind_service,
enable => true, enable => true,
hasrestart => true, hasrestart => true,
hasstatus => true, hasstatus => true,

View File

@ -10,6 +10,8 @@ define bind::key (
$keyfile = undef, $keyfile = undef,
$include = true, $include = true,
) { ) {
include bind::params
$confdir = $::bind::params::confdir
# Generate a key of size $secret_bits if no $secret # Generate a key of size $secret_bits if no $secret
$secret_actual = $secret ? { $secret_actual = $secret ? {
@ -43,7 +45,7 @@ define bind::key (
concat::fragment { "bind-key-${name}": concat::fragment { "bind-key-${name}":
order => '10', order => '10',
target => "${bind::confdir}/keys.conf", target => "${bind::params::confdir}/keys.conf",
content => "include \"${keydir}/${key_file_name}\";\n", content => "include \"${keydir}/${key_file_name}\";\n",
} }
} }

View File

@ -7,7 +7,8 @@ class bind::params (
$bind_package, $bind_package,
$bind_service, $bind_service,
$nsupdate_package, $nsupdate_package,
$managed_keys_directory = nil, $managed_keys_directory = undef,
$confdir,
) { ) {
unless $supported { unless $supported {
fail('Platform is not supported') fail('Platform is not supported')

View File

@ -2,13 +2,12 @@
class bind::updater ( class bind::updater (
$keydir = undef, $keydir = undef,
) { ) inherits bind::params {
include params
if $::bind::params::nsupdate_package { if $nsupdate_package {
package { 'nsupdate': package { 'nsupdate':
ensure => present, ensure => present,
name => $::bind::params::nsupdate_package, name => $nsupdate_package,
} }
} }

View File

@ -1,3 +1,3 @@
--- ---
bind::confdir: '_CONFDIR_' bind::params::confdir: '_CONFDIR_'
bind::namedconf: '_NAMEDCONF_' bind::namedconf: '_NAMEDCONF_'