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

Fix allow_bash_command_substitution #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
30 changes: 30 additions & 0 deletions spec/classes/nrpe_config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,36 @@
it { is_expected.to contain_user('nrpe').with_groups(%w[foo bar]) }
end
end

describe 'allow_bash_command_substitution' do
context 'by default' do
let(:pre_condition) { 'include nrpe' }

it { is_expected.not_to contain_concat__fragment('nrpe main config').with_content(%r{^allow_bash_command_substitution}) }
end
context 'when true' do
let(:pre_condition) do
<<-PRE_CONDITION
class { 'nrpe':
allow_bash_command_substitution => true,
}
PRE_CONDITION
end

it { is_expected.to contain_concat__fragment('nrpe main config').with_content(%r{^allow_bash_command_substitution=1$}) }
end
context 'when false' do
let(:pre_condition) do
<<-PRE_CONDITION
class { 'nrpe':
allow_bash_command_substitution => false,
}
PRE_CONDITION
end

it { is_expected.to contain_concat__fragment('nrpe main config').with_content(%r{^allow_bash_command_substitution=0$}) }
end
end
end
end
end
2 changes: 1 addition & 1 deletion templates/nrpe.cfg.epp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
String $nrpe_group,
Array[Stdlib::Host] $allowed_hosts,
Enum['0','1'] $dont_blame_nrpe,
Optional[Boolean] $allow_bash_command_substitution,
Optional[Enum['0','1']] $allow_bash_command_substitution,
Stdlib::Absolutepath $libdir,
Optional[Stdlib::Absolutepath] $command_prefix,
Enum['0','1'] $debug,
Expand Down