Showing with 14 additions and 5 deletions.
  1. +1 −1 Modulefile
  2. +2 −4 manifests/init.pp
  3. +11 −0 spec/classes/init_spec.rb
2 changes: 1 addition & 1 deletion Modulefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name 'ghoneycutt-ssh'
version '3.2.0'
version '3.2.1'
source 'git://github.com/ghoneycutt/puppet-module-ssh.git'
author 'ghoneycutt'
license 'Apache License, Version 2.0'
Expand Down
6 changes: 2 additions & 4 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,7 @@

# manage users' ssh authorized keys if present
if $keys != undef {
$keys_type = type($keys)
if $keys_type == 'hash' {
create_resources(ssh_authorized_key, $keys)
}
validate_hash($keys)
create_resources(ssh_authorized_key, $keys)
}
}
11 changes: 11 additions & 0 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -710,4 +710,15 @@
})
}
end

context 'with keys specified as not of type hash' do
let(:params) { { :keys => [ 'not', 'a', 'hash' ] } }
let(:facts) { { :osfamily => 'RedHat' } }

it 'should fail' do
expect {
should include_class('ssh')
}.to raise_error(Puppet::Error)
end
end
end