From 3a1a7d397f1badf50e0ec18360796d570bfb82e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sat, 10 Jun 2023 17:48:48 +0200 Subject: Force all zone names to end in a period. --- manifests/zone.pp | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) (limited to 'manifests/zone.pp') diff --git a/manifests/zone.pp b/manifests/zone.pp index 4926eed..2ab14a8 100644 --- a/manifests/zone.pp +++ b/manifests/zone.pp @@ -73,7 +73,7 @@ define dns::zone ( Dns::Ttl $ttl = '24h', Optional[Dns::Ttl] $soa_ttl = undef, - String $zone = $name, + Dns::Zonename $zone = $name, Array[Dns::RecordEntry] $records = [], @@ -96,10 +96,8 @@ define dns::zone ( Enum['present', 'absent'] $ensure = 'present', ) { - $zone_ = dns::ensure_ending_period($zone) - if $ensure == 'present' { - dns_zone2 { $zone_: + dns_zone2 { $zone: ensure => 'present', rname => $rname, mname => $mname, @@ -124,28 +122,28 @@ define dns::zone ( } if $dynamic { - exec { "Dns::zone freeze ${zone_}": - command => [$dns::rndc, 'freeze', $zone_], + exec { "Dns::zone freeze ${zone}": + command => [$dns::rndc, 'freeze', $zone], refreshonly => true, - notify => Dns_zone2[$zone_], + notify => Dns_zone2[$zone], } - exec { "Dns::zone thaw ${zone_}": - command => [$dns::rndc, 'thaw', $zone_], + exec { "Dns::zone thaw ${zone}": + command => [$dns::rndc, 'thaw', $zone], refreshonly => true, - subscribe => Dns_zone2[$zone_], + subscribe => Dns_zone2[$zone], } } else { - exec { "Dns::zone reload ${zone_}": - command => [$dns::rndc, 'reload', $zone_], + exec { "Dns::zone reload ${zone}": + command => [$dns::rndc, 'reload', $zone], refreshonly => true, - subscribe => Dns_zone2[$zone_], + subscribe => Dns_zone2[$zone], } } $ns.each |$entry| { - dns::record { "${zone_} NS ${entry}": - zone => $zone_, + dns::record { "${zone} NS ${entry}": + zone => $zone, key => '@', type => 'NS', value => $entry, @@ -153,9 +151,9 @@ define dns::zone ( } $records.each |$record| { - $name = "${zone_} ${record['type']} ${record['key']} ${record['value']}" + $name = "${zone} ${record['type']} ${record['key']} ${record['value']}" dns::record { $name: - zone => $zone_, + zone => $zone, type => $record['type'], value => $record['value'], cls => $record['dns_class'], @@ -163,18 +161,18 @@ define dns::zone ( } } } else { - dns_zone2 { $zone_: + dns_zone2 { $zone: ensure => 'absent', } } - file { "${dns::zoneconf_dir}/${zone_}conf": + file { "${dns::zoneconf_dir}/${zone}conf": ensure => $ensure, content => epp("${module_name}/zoneconf.epp", { - zone => $zone_, + zone => $zone, type => $type, update_policy => $update_policy, }), - require => Dns_zone2[$zone_], + require => Dns_zone2[$zone], } } -- cgit v1.2.3