Skip to content

Commit 279d803

Browse files
kajinamitekohl
authored andcommitted
Add parameter to control listen-on
... so that both listen-on and listen-on-v6 can be managed by the native parameters.
1 parent 0a8cdcc commit 279d803

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

manifests/init.pp

+3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
# The forward option
4444
# @param forwarders
4545
# The forwarders option
46+
# @param listen_on
47+
# The listen-on option
4648
# @param listen_on_v6
4749
# The listen-on-v6 option
4850
# @param recursion
@@ -159,6 +161,7 @@
159161
Variant[Enum['unmanaged'], Stdlib::Absolutepath] $defaultzonepath = $dns::params::defaultzonepath,
160162
Optional[Enum['only', 'first']] $forward = undef,
161163
Array[Dns::Forwarder] $forwarders = [],
164+
Optional[String] $listen_on = undef,
162165
Variant[String, Boolean] $listen_on_v6 = 'any',
163166
Enum['yes', 'no'] $recursion = 'yes',
164167
Array[String] $allow_recursion = ['localnets', 'localhost'],

spec/classes/dns_init_spec.rb

+8
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,14 @@
250250
end
251251
end
252252

253+
describe 'with ipv4 disabled' do
254+
let(:params) { {:listen_on => 'none'} }
255+
256+
it { verify_concat_fragment_contents(catalogue, 'options.conf+10-main.dns', [
257+
'listen-on { none; };',
258+
])}
259+
end
260+
253261
describe 'with ipv6 disabled' do
254262
let(:params) { {:listen_on_v6 => 'none'} }
255263

templates/options.conf.erb

+3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ empty-zones-enable <%= scope.lookupvar('::dns::empty_zones_enable') %>;
1818
<% unless [nil, :undefined, :undef, ''].include?(scope.lookupvar('::dns::dns_notify')) -%>
1919
notify <%= scope.lookupvar('::dns::dns_notify') %>;
2020
<% end -%>
21+
<% unless [nil, :undefined, :undef, ''].include?(scope.lookupvar('::dns::listen_on')) -%>
22+
listen-on { <%= scope.lookupvar('::dns::listen_on') %>; };
23+
<% end -%>
2124
<% unless [false, nil, :undefined, :undef, ''].include?(scope.lookupvar('::dns::listen_on_v6')) -%>
2225
listen-on-v6 { <%= scope.lookupvar('::dns::listen_on_v6') %>; };
2326
<% end -%>

0 commit comments

Comments
 (0)