From 210532a27dfb416e91316480cfbc36a9d53b0bee Mon Sep 17 00:00:00 2001 From: b4ldr Date: Mon, 8 Aug 2016 14:09:28 +0100 Subject: [PATCH] update tsig key locality --- manifests/zone.pp | 11 +++++++++++ templates/etc/knot/knot.zones.conf.erb | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/manifests/zone.pp b/manifests/zone.pp index 6752a53..5b32c37 100644 --- a/manifests/zone.pp +++ b/manifests/zone.pp @@ -8,6 +8,7 @@ $zones = [], $zonefile = undef, $zone_dir = undef, + $tsig_name = undef, ) { validate_array($masters) @@ -25,6 +26,16 @@ } else { $zone_subdir = $::knot::zone_subdir } + if $tsig_name { + validate_string($tsig_name) + if defined(Knot::Tsig[$tsig_name]) { + $_tsig_name = $tsig_name + } else { + fail("Nsd::Tsig['${tsig_name}'] does not exist") + } + } elsif has_key($::knot::tsig, 'name') { + $_tsig_name = $::knot::tsig['name'] + } concat::fragment{ "knot_zones_${name}": target => $::knot::conf_file, content => template($::knot::zones_template), diff --git a/templates/etc/knot/knot.zones.conf.erb b/templates/etc/knot/knot.zones.conf.erb index cfa50d1..29b561a 100644 --- a/templates/etc/knot/knot.zones.conf.erb +++ b/templates/etc/knot/knot.zones.conf.erb @@ -3,8 +3,8 @@ remotes { xfr-in-<%= @name %><%= index + 1 %> { address <%= master %>; port 53; - <%- if @tsig then -%> - key <%= @tsig['name'] %>; + <%- if @_tsig_name then -%> + key <%= @_tsig_name %>; <%- end -%> } <%- end -%>