Update hostcertificated to take both Strings and Arrays
This commit is contained in:
parent
0ac138213e
commit
4cefc65069
@ -845,7 +845,9 @@ class ssh (
|
||||
}
|
||||
|
||||
if $sshd_config_hostcertificate_real != undef {
|
||||
if is_array($sshd_config_hostcertificate_real) {
|
||||
validate_array($sshd_config_hostcertificate_real)
|
||||
}
|
||||
validate_absolute_path($sshd_config_hostcertificate_real)
|
||||
}
|
||||
|
||||
|
@ -1075,7 +1075,7 @@ describe 'sshd_config_print_last_log param' do
|
||||
end
|
||||
|
||||
context 'with a certificate' do
|
||||
let(:params) { { :sshd_config_hostcertificate => ['/etc/ssh/ssh_host_key-cert.pub'] } }
|
||||
let(:params) { { :sshd_config_hostcertificate => '/etc/ssh/ssh_host_key-cert.pub' } }
|
||||
|
||||
it { should contain_file('sshd_config').with_content(/^HostCertificate \/etc\/ssh\/ssh_host_key-cert\.pub/) }
|
||||
end
|
||||
@ -1088,12 +1088,14 @@ describe 'sshd_config_print_last_log param' do
|
||||
end
|
||||
|
||||
context 'with sshd_config_hostcertificate set to invalid value on valid osfamily' do
|
||||
context 'with string' do
|
||||
let(:params) { { :sshd_config_hostcertificate => 'invalid' } }
|
||||
|
||||
it 'should fail' do
|
||||
expect {
|
||||
should contain_class('ssh')
|
||||
}.to raise_error(Puppet::PreformattedError,/"invalid" is not an Array/)
|
||||
}.to raise_error(Puppet::Error,/"invalid" is not an absolute path/)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -263,10 +263,12 @@ Match <%= key %>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
<% if @sshd_config_hostcertificate_real -%>
|
||||
<% if @sshd_config_hostcertificate_real.class == Array -%>
|
||||
<% @sshd_config_hostcertificate_real.each do |cert| -%>
|
||||
HostCertificate <%= cert %>
|
||||
<% end -%>
|
||||
<% elsif @sshd_config_hostcertificate_real.class == String -%>
|
||||
HostCertificate <%= @sshd_config_hostcertificate_real %>
|
||||
<% end -%>
|
||||
<% if @sshd_config_trustedusercakeys_real -%>
|
||||
TrustedUserCAKeys <%= @sshd_config_trustedusercakeys_real %>
|
||||
|
Loading…
x
Reference in New Issue
Block a user