Merge pull request #35 from ghoneycutt/validate_keys_hash
Validate keys parameter
This commit is contained in:
commit
799e24f9bf
@ -239,9 +239,7 @@ class ssh (
|
|||||||
|
|
||||||
# manage users' ssh authorized keys if present
|
# manage users' ssh authorized keys if present
|
||||||
if $keys != undef {
|
if $keys != undef {
|
||||||
$keys_type = type($keys)
|
validate_hash($keys)
|
||||||
if $keys_type == 'hash' {
|
create_resources(ssh_authorized_key, $keys)
|
||||||
create_resources(ssh_authorized_key, $keys)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -710,4 +710,15 @@ describe 'ssh' do
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
end
|
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
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user