Skip to content

Commit

Permalink
Merge pull request thias#64 from inkblot/fix-updater-warnings
Browse files Browse the repository at this point in the history
Put confdir in the params class, and more..
  • Loading branch information
inkblot committed Dec 26, 2015
2 parents 1af06cb + 250cb4e commit 07a7aca
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 21 deletions.
2 changes: 1 addition & 1 deletion data/osfamily/Debian.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion data/osfamily/RedHat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
18 changes: 6 additions & 12 deletions manifests/init.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# ex: syntax=puppet si ts=4 sw=4 et

class bind (
$confdir = undef,
$namedconf = undef,
$cachedir = undef,
$forwarders = undef,
Expand All @@ -11,32 +10,27 @@
$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'],
}

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 {
Expand Down Expand Up @@ -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'],
Expand All @@ -105,7 +99,7 @@

service { 'bind':
ensure => running,
name => $::bind::params::bind_service,
name => $bind_service,
enable => true,
hasrestart => true,
hasstatus => true,
Expand Down
4 changes: 3 additions & 1 deletion manifests/key.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ? {
Expand Down Expand Up @@ -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",
}
}
Expand Down
3 changes: 2 additions & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
7 changes: 3 additions & 4 deletions manifests/updater.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}

Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/hiera/common.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
bind::confdir: '_CONFDIR_'
bind::params::confdir: '_CONFDIR_'
bind::namedconf: '_NAMEDCONF_'

0 comments on commit 07a7aca

Please sign in to comment.