From 250cb4e4c60b58be9b9878b0fc07c8fe94bcc46c Mon Sep 17 00:00:00 2001 From: Nate Riffe Date: Sat, 26 Dec 2015 00:58:02 -0600 Subject: [PATCH] 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. --- data/osfamily/Debian.yaml | 2 +- data/osfamily/RedHat.yaml | 2 +- manifests/init.pp | 18 ++++++------------ manifests/key.pp | 4 +++- manifests/params.pp | 3 ++- manifests/updater.pp | 7 +++---- spec/fixtures/hiera/common.yaml | 2 +- 7 files changed, 17 insertions(+), 21 deletions(-) diff --git a/data/osfamily/Debian.yaml b/data/osfamily/Debian.yaml index 735d72a1..79f6ff1d 100644 --- a/data/osfamily/Debian.yaml +++ b/data/osfamily/Debian.yaml @@ -5,8 +5,8 @@ bind::params::bind_group: 'bind' bind::params::bind_package: 'bind9' bind::params::bind_service: 'bind9' bind::params::nsupdate_package: 'dnsutils' +bind::params::confdir: '/etc/bind' bind::namedconf: '/etc/bind/named.conf' -bind::confdir: '/etc/bind' bind::cachedir: '/var/cache/bind' bind::rndc: true diff --git a/data/osfamily/RedHat.yaml b/data/osfamily/RedHat.yaml index e170f3b5..db94be8c 100644 --- a/data/osfamily/RedHat.yaml +++ b/data/osfamily/RedHat.yaml @@ -6,8 +6,8 @@ bind::params::bind_package: 'bind' bind::params::bind_service: 'named' bind::params::nsupdate_package: 'bind-utils' bind::params::managed_keys_directory: '/var/named/dynamic' +bind::params::confdir: '/etc/named' bind::namedconf: '/etc/named.conf' -bind::confdir: '/etc/named' bind::cachedir: '/var/named' bind::rndc: true diff --git a/manifests/init.pp b/manifests/init.pp index 314fed22..8d236e4c 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,7 +1,6 @@ # ex: syntax=puppet si ts=4 sw=4 et class bind ( - $confdir = undef, $namedconf = undef, $cachedir = undef, $forwarders = undef, @@ -11,18 +10,13 @@ $statistics_port = undef, $random_device = undef, $include_local = undef, -) { - include ::bind::params - - # Re-scope members of bind::params for templating - $managed_keys_directory = $::bind::params::managed_keys_directory - +) inherits bind::params { $auth_nxdomain = false File { ensure => present, owner => 'root', - group => $::bind::params::bind_group, + group => $bind_group, mode => '0644', require => Package['bind'], notify => Service['bind'], @@ -30,13 +24,13 @@ package{'bind-tools': ensure => latest, - name => $::bind::params::nsupdate_package, + name => $nsupdate_package, before => Package['bind'], } package { 'bind': ensure => latest, - name => $::bind::params::bind_package, + name => $bind_package, } if $dnssec { @@ -79,7 +73,7 @@ "${confdir}/views.conf", ]: owner => 'root', - group => $::bind::params::bind_group, + group => $bind_group, mode => '0644', require => Package['bind'], notify => Service['bind'], @@ -105,7 +99,7 @@ service { 'bind': ensure => running, - name => $::bind::params::bind_service, + name => $bind_service, enable => true, hasrestart => true, hasstatus => true, diff --git a/manifests/key.pp b/manifests/key.pp index 765b2eaa..f7bc4ab3 100644 --- a/manifests/key.pp +++ b/manifests/key.pp @@ -10,6 +10,8 @@ $keyfile = undef, $include = true, ) { + include bind::params + $confdir = $::bind::params::confdir # Generate a key of size $secret_bits if no $secret $secret_actual = $secret ? { @@ -43,7 +45,7 @@ concat::fragment { "bind-key-${name}": order => '10', - target => "${bind::confdir}/keys.conf", + target => "${bind::params::confdir}/keys.conf", content => "include \"${keydir}/${key_file_name}\";\n", } } diff --git a/manifests/params.pp b/manifests/params.pp index 158d8a1e..f3c74a41 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -7,7 +7,8 @@ $bind_package, $bind_service, $nsupdate_package, - $managed_keys_directory = nil, + $managed_keys_directory = undef, + $confdir, ) { unless $supported { fail('Platform is not supported') diff --git a/manifests/updater.pp b/manifests/updater.pp index daa1239a..a15c59b0 100644 --- a/manifests/updater.pp +++ b/manifests/updater.pp @@ -2,13 +2,12 @@ class bind::updater ( $keydir = undef, -) { - include params +) inherits bind::params { - if $::bind::params::nsupdate_package { + if $nsupdate_package { package { 'nsupdate': ensure => present, - name => $::bind::params::nsupdate_package, + name => $nsupdate_package, } } diff --git a/spec/fixtures/hiera/common.yaml b/spec/fixtures/hiera/common.yaml index 12f29a75..44a9e846 100644 --- a/spec/fixtures/hiera/common.yaml +++ b/spec/fixtures/hiera/common.yaml @@ -1,3 +1,3 @@ --- -bind::confdir: '_CONFDIR_' +bind::params::confdir: '_CONFDIR_' bind::namedconf: '_NAMEDCONF_'