Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add parameter to set disable-empty-zone option #259

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 -%>
Loading