From 28b53e9b9aee82997b5dd41fb55a063627791767 Mon Sep 17 00:00:00 2001 From: b4ldr Date: Wed, 8 Jun 2016 16:00:52 +0100 Subject: [PATCH] update test and fix slave addresses --- manifests/zone.pp | 1 - spec/classes/knot_spec.rb | 6 +++--- spec/defines/tsig_spec.rb | 6 +++--- spec/defines/zone_spec.rb | 26 +++++++++++++------------- templates/etc/knot/knot.zones.conf.erb | 4 ++-- 5 files changed, 21 insertions(+), 22 deletions(-) diff --git a/manifests/zone.pp b/manifests/zone.pp index de9b9df..6752a53 100644 --- a/manifests/zone.pp +++ b/manifests/zone.pp @@ -25,7 +25,6 @@ } else { $zone_subdir = $::knot::zone_subdir } - $slave_addresses = $::knot::slave_addresses concat::fragment{ "knot_zones_${name}": target => $::knot::conf_file, content => template($::knot::zones_template), diff --git a/spec/classes/knot_spec.rb b/spec/classes/knot_spec.rb index 51f6467..12301e2 100644 --- a/spec/classes/knot_spec.rb +++ b/spec/classes/knot_spec.rb @@ -102,7 +102,7 @@ it do is_expected.to contain_concat__fragment('knot_server') .with( - 'order' => '01', + 'order' => '10', 'target' => conf_file ).with_content( /identity foo.example.com;/ @@ -142,7 +142,7 @@ is_expected.to contain_concat__fragment('key_head') .with( 'content' => /keys {/, - 'order' => '09', + 'order' => '01', 'target' => conf_file ) @@ -151,7 +151,7 @@ is_expected.to contain_concat__fragment('key_foot') .with( 'content' => /}/, - 'order' => '11', + 'order' => '03', 'target' => conf_file ) diff --git a/spec/defines/tsig_spec.rb b/spec/defines/tsig_spec.rb index 43af677..97fa189 100644 --- a/spec/defines/tsig_spec.rb +++ b/spec/defines/tsig_spec.rb @@ -43,7 +43,7 @@ is_expected.to contain_concat__fragment('knot_key_foo.example.com') .with( 'content' => /foo.example.com hmac-sha256 "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="/, - 'order' => '10', + 'order' => '02', ) end end @@ -56,7 +56,7 @@ is_expected.to contain_concat__fragment('knot_key_foo.example.com') .with( 'content' => /foo.example.com hmac-md5 "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="/, - 'order' => '10', + 'order' => '02', ) end end @@ -67,7 +67,7 @@ is_expected.to contain_concat__fragment('knot_key_foo.example.com') .with( 'content' => /foo.example.com hmac-sha256 "foobar"/, - 'order' => '10', + 'order' => '02', ) end end diff --git a/spec/defines/zone_spec.rb b/spec/defines/zone_spec.rb index a28a192..59068a3 100644 --- a/spec/defines/zone_spec.rb +++ b/spec/defines/zone_spec.rb @@ -60,7 +60,7 @@ .with_content( /remotes {\n}/ ).with_content( - /groups {\n}/ + /groups {\s+xfr-in-example\s+{\s+}\s+xfr-out-example\s+{\s+}\s+notify-out-example\s+{\s+}\s+notify-in-example\s+{\s+}\s+}/ ).with_content( /zones {\n}/ ) @@ -79,31 +79,31 @@ it do is_expected.to contain_concat__fragment('knot_zones_example') .with_content( - /remotes\s+{[\s\S]+master1-example\s+{\s+address\s+192.0.2.1;\s+port\s+53;\s+}[\s\S]+\n}/ + /remotes\s+{[\s\S]+xfr-out-example1\s+{\s+address\s+192.0.2.1;\s+port\s+53;\s+}[\s\S]+\n}/ ).with_content( - /remotes\s+{[\s\S]+slave1-example\s+{\s+address\s+192.0.2.1;\s+port\s+53;\s+}[\s\S]+\n}/ + /remotes\s+{[\s\S]+xfr-in-example1\s+{\s+address\s+192.0.2.1;\s+port\s+53;\s+}[\s\S]+\n}/ ).with_content( - /remotes\s+{[\s\S]+notify1-example-out\s+{\s+address\s+192.0.2.1;\s+port\s+53;\s+}[\s\S]+\n}/ + /remotes\s+{[\s\S]+notify-out-example1\s+{\s+address\s+192.0.2.1;\s+port\s+53;\s+}[\s\S]+\n}/ ).with_content( - /remotes\s+{[\s\S]+notify1-example-in\s+{\s+address\s+192.0.2.1;\s+port\s+53;\s+}[\s\S]+\n}/ + /remotes\s+{[\s\S]+notify-in-example1\s+{\s+address\s+192.0.2.1;\s+port\s+53;\s+}[\s\S]+\n}/ ).with_content( - /groups\s+{[\s\S]+master-example\s+{\s+master1-example\s+}[\s\S]+\n}/ + /groups\s+{[\s\S]+xfr-in-example\s+{\s+xfr-in-example1\s+}[\s\S]+\n}/ ).with_content( - /groups\s+{[\s\S]+slave-example\s+{\s+slave1-example\s+}[\s\S]+\n}/ + /groups\s+{[\s\S]+xfr-out-example\s+{\s+xfr-out-example1\s+}[\s\S]+\n}/ ).with_content( - /groups\s+{[\s\S]+notify-example-in\s+{\s+notify1-example-in\s+}[\s\S]+\n}/ + /groups\s+{[\s\S]+notify-in-example\s+{\s+notify-in-example1\s+}[\s\S]+\n}/ ).with_content( - /groups\s+{[\s\S]+notify-example-out\s+{\s+notify1-example-out\s+}[\s\S]+\n}/ + /groups\s+{[\s\S]+notify-out-example\s+{\s+notify-out-example1\s+}[\s\S]+\n}/ ).with_content( /zones\s+{\s+"example.com"\s+{[\s\S]+file\s+"#{zone_subdir}\/example.com"[\s\S]+\n}/ ).with_content( - /zones\s+{\s+"example.com"\s+{[\s\S]+notify-out\s+notify-example-out[\s\S]+\n}/ + /zones\s+{\s+"example.com"\s+{[\s\S]+notify-out\s+notify-out-example[\s\S]+\n}/ ).with_content( - /zones\s+{\s+"example.com"\s+{[\s\S]+notify-in\s+notify-example-in[\s\S]+\n}/ + /zones\s+{\s+"example.com"\s+{[\s\S]+notify-in\s+notify-in-example[\s\S]+\n}/ ).with_content( - /zones\s+{\s+"example.com"\s+{[\s\S]+xfr-in\s+master-example[\s\S]+\n}/ + /zones\s+{\s+"example.com"\s+{[\s\S]+xfr-in\s+xfr-in-example[\s\S]+\n}/ ).with_content( - /zones\s+{\s+"example.com"\s+{[\s\S]+xfr-out\s+slave-example[\s\S]+\n}/ + /zones\s+{\s+"example.com"\s+{[\s\S]+xfr-out\s+xfr-out-example[\s\S]+\n}/ ) end end diff --git a/templates/etc/knot/knot.zones.conf.erb b/templates/etc/knot/knot.zones.conf.erb index d035619..cfa50d1 100644 --- a/templates/etc/knot/knot.zones.conf.erb +++ b/templates/etc/knot/knot.zones.conf.erb @@ -35,12 +35,12 @@ groups { } xfr-out-<%= @name %> { <%- @provide_xfr.each_with_index do |xfr, index| -%> - xfr-out-<%= @name %><%= index + 1 %><% if index + 1 < @provide_xfr.length then %>,<%- end -%> + xfr-out-<%= @name %><%= index + 1 %><% if index + 1 < @provide_xfr.length then %>,<%- end %> <%- end %> } notify-out-<%= @name %> { <%- @notify_addresses.each_with_index do |notify_address, index| -%> - notify-out-<%= @name %><%= index + 1 %><% if index + 1 < @notify_addresses.length then %>,<%- end -%> + notify-out-<%= @name %><%= index + 1 %><% if index + 1 < @notify_addresses.length then %>,<%- end %> <%- end %> } notify-in-<%= @name %> {