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

Allow configuration checks to be turned off #178

Merged
merged 1 commit into from
Nov 1, 2020
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
10 changes: 8 additions & 2 deletions manifests/config.pp
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
# Configure dns
# @api private
class dns::config {
if $dns::config_check {
$validate_cmd = "${dns::named_checkconf} %"
} else {
$validate_cmd = undef
}

concat { $dns::publicviewpath:
owner => root,
group => $dns::params::group,
mode => '0640',
validate_cmd => "${dns::named_checkconf} %",
validate_cmd => $validate_cmd,
}

if $dns::enable_views {
Expand All @@ -28,7 +34,7 @@
group => $dns::params::group,
mode => '0640',
require => Concat[$dns::optionspath],
validate_cmd => "${dns::named_checkconf} %",
validate_cmd => $validate_cmd,
}

# This file cannot be checked by named-checkconf because its content is only
Expand Down
5 changes: 5 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@
# setting `service_restart_command` to `/usr/sbin/service bind9 reload` or
# `/usr/sbin/rndc reload` or even `/usr/bin/systemctl try-reload-or-restart bind9`.
# Default is 'undef' so the service resource default is used.
# @param config_check
# Should this module run configuration checks before putting new configurations in
# place? Defaults to true. Set to false if you don't want configuration checks when
# config files are changed.
# @param additional_options
# Additional options
# @param additional_directives
Expand Down Expand Up @@ -168,6 +172,7 @@
Variant[Enum['running', 'stopped'], Boolean] $service_ensure = $dns::params::service_ensure,
Boolean $service_enable = $dns::params::service_enable,
Optional[String[1]] $service_restart_command = $dns::params::service_restart_command,
Boolean $config_check = $dns::params::config_check,
coreone marked this conversation as resolved.
Show resolved Hide resolved
Hash[String, Data] $additional_options = $dns::params::additional_options,
Array[String] $additional_directives = $dns::params::additional_directives,
Boolean $enable_views = $dns::params::enable_views,
Expand Down
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@
$manage_service = true
$service_ensure = 'running'
$service_enable = true
$config_check = true
$acls = {}

$additional_options = {}
Expand Down
11 changes: 11 additions & 0 deletions spec/classes/dns_init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,17 @@
it { should contain_file("#{etc_directory}/dns-key.key") }
end

describe 'with config_check set to false' do
let(:params) { { :config_check => false } }

it { is_expected.to compile.with_all_deps }

it {
is_expected.to contain_concat("#{etc_directory}/named.conf")
.without_validate_cmd()
}
end

context 'sysconfig', if: ['Debian', 'RedHat'].include?(os_facts[:os]['family']) do
let(:sysconfig_named_path) do
case facts[:os]['family']
Expand Down