Address review comments
This commit is contained in:
parent
46b6df1240
commit
4d6e2260dd
@ -593,6 +593,17 @@ class ssh (
|
||||
if $ssh_config_include == 'USE_DEFAULTS' {
|
||||
$ssh_config_include_real = $default_ssh_config_include
|
||||
} else {
|
||||
case type3x($ssh_config_include) {
|
||||
'array': {
|
||||
validate_array($ssh_config_include)
|
||||
}
|
||||
'string': {
|
||||
validate_string($ssh_config_include)
|
||||
}
|
||||
default: {
|
||||
fail('ssh::ssh_config_include type must be a strting or array.')
|
||||
}
|
||||
}
|
||||
$ssh_config_include_real = $ssh_config_include
|
||||
}
|
||||
|
||||
@ -668,6 +679,17 @@ class ssh (
|
||||
if $sshd_config_include == 'USE_DEFAULTS' {
|
||||
$sshd_config_include_real = $default_sshd_config_include
|
||||
} else {
|
||||
case type3x($sshd_config_include) {
|
||||
'array': {
|
||||
validate_array($sshd_config_include)
|
||||
}
|
||||
'string': {
|
||||
validate_string($sshd_config_include)
|
||||
}
|
||||
default: {
|
||||
fail('ssh::sshd_config_include type must be a strting or array.')
|
||||
}
|
||||
}
|
||||
$sshd_config_include_real = $sshd_config_include
|
||||
}
|
||||
|
||||
|
@ -2786,4 +2786,61 @@ describe 'sshd_config_print_last_log param' do
|
||||
end # var[:name].each
|
||||
end # validations.sort.each
|
||||
end # describe 'variable type and content validations'
|
||||
|
||||
describe 'sshd_config_include' do
|
||||
context 'when set to an array' do
|
||||
let(:params) { {'sshd_config_include' => ['file1','file2'] } }
|
||||
|
||||
it { should contain_file('sshd_config').with_content(/^Include file1 file2$/) }
|
||||
end
|
||||
|
||||
context 'when set to a string' do
|
||||
let(:params) { {'sshd_config_include' => 'file1' } }
|
||||
|
||||
it { should contain_file('sshd_config').with_content(/^Include file1$/) }
|
||||
end
|
||||
|
||||
context 'when not set' do
|
||||
it { should_not contain_file('sshd_config').with_content(/^\s*Include/) }
|
||||
end
|
||||
|
||||
context 'when set to an invalid type (not string or array)' do
|
||||
let(:params) { {'sshd_config_include' => true } }
|
||||
|
||||
it 'should fail' do
|
||||
expect {
|
||||
should contain_class('ssh')
|
||||
}.to raise_error(Puppet::Error)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'ssh_config_include' do
|
||||
context 'when set to an array' do
|
||||
let(:params) { {'ssh_config_include' => ['file1','file2'] } }
|
||||
|
||||
it { should contain_file('ssh_config').with_content(/^Include file1 file2$/) }
|
||||
end
|
||||
|
||||
context 'when set to a string' do
|
||||
let(:params) { {'ssh_config_include' => 'file1' } }
|
||||
|
||||
it { should contain_file('ssh_config').with_content(/^Include file1$/) }
|
||||
end
|
||||
|
||||
context 'when not set' do
|
||||
it { should_not contain_file('ssh_config').with_content(/^\s*Include/) }
|
||||
end
|
||||
|
||||
context 'when set to an invalid type (not string or array)' do
|
||||
let(:params) { {'ssh_config_include' => true } }
|
||||
|
||||
it 'should fail' do
|
||||
expect {
|
||||
should contain_class('ssh')
|
||||
}.to raise_error(Puppet::Error)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -1,5 +0,0 @@
|
||||
# config files to be includes
|
||||
# @summary
|
||||
# directory of array of directories to be included
|
||||
#
|
||||
type Ssh::Include = Variant[String[1],Array[String[1]]]
|
Loading…
x
Reference in New Issue
Block a user