Skip to content

Commit

Permalink
Add parameter to set disable-empty-zone option
Browse files Browse the repository at this point in the history
disable-empty-zone allows one to disable the automatically created zones

Fixes: #255
  • Loading branch information
bigon committed Jun 27, 2024
1 parent 39e3107 commit e47fb48
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@
# A hash of logging categories to be created. See dns::logging::category for options.
# @param logging_channels
# A hash of logging channels to be created. See dns::logging::channel for options.
# @param disable_empty_zones
# A hash containing a list of empty zones that shouldn't be created by bind
# See: https://kb.isc.org/docs/aa-00800
#
# @see dns::zone
# @see dns::key
Expand Down Expand Up @@ -186,6 +189,7 @@
Hash[String, Hash] $keys = {},
Hash[String, Hash] $logging_categories = {},
Hash[String, Hash] $logging_channels = {},
Array[Stdlib::Fqdn] $disable_empty_zones = [],
) inherits dns::params {
include dns::install
include dns::config
Expand Down
9 changes: 9 additions & 0 deletions spec/classes/dns_init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,15 @@
])}
end

describe 'with disable empty zones' do
let(:params) { { :disable_empty_zones => ["16.172.IN-ADDR.ARPA", "17.172.IN-ADDR.ARPA"] } }

it { verify_concat_fragment_contents(catalogue, 'options.conf+10-main.dns', [
'disable-empty-zone "16.172.IN-ADDR.ARPA";',
'disable-empty-zone "17.172.IN-ADDR.ARPA";'
])}
end

describe 'with additional options' do
let(:params) { { :additional_options => { 'max-cache-ttl' => 3600, 'max-ncache-ttl' => 3600 } } }

Expand Down
4 changes: 4 additions & 0 deletions templates/options.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ allow-recursion { <%= scope.lookupvar('::dns::allow_recursion').join("; ") %>; }
pid-file "/var/run/named/pid";
<% end -%>

<%- scope.lookupvar('::dns::disable_empty_zones').sort.each do |disable_empty_zone| -%>
disable-empty-zone "<%= disable_empty_zone %>";
<%- end -%>

<%- scope.lookupvar('::dns::additional_options').sort_by {|k, v| k}.each do |option, value| -%>
<%= option %> <%= value %>;
<%- end -%>

0 comments on commit e47fb48

Please sign in to comment.