Merge "Validate keys for nova_public_key/nova_private_key"
This commit is contained in:
@@ -445,8 +445,8 @@ class nova(
|
|||||||
$ca_file = false,
|
$ca_file = false,
|
||||||
$cert_file = false,
|
$cert_file = false,
|
||||||
$key_file = false,
|
$key_file = false,
|
||||||
Optional[Hash] $nova_public_key = undef,
|
Nova::SshKey $nova_public_key = undef,
|
||||||
Optional[Hash] $nova_private_key = undef,
|
Nova::SshKey $nova_private_key = undef,
|
||||||
$ssl_only = $facts['os_service_default'],
|
$ssl_only = $facts['os_service_default'],
|
||||||
$cert = $facts['os_service_default'],
|
$cert = $facts['os_service_default'],
|
||||||
$key = $facts['os_service_default'],
|
$key = $facts['os_service_default'],
|
||||||
|
37
spec/type_aliases/sshkey_spec.rb
Normal file
37
spec/type_aliases/sshkey_spec.rb
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe 'Nova::SshKey' do
|
||||||
|
describe 'valid types' do
|
||||||
|
context 'with valid types' do
|
||||||
|
[
|
||||||
|
{'key' => 'foo'},
|
||||||
|
{'type' => 'bar'},
|
||||||
|
{'key' => 'foo', 'type' => 'bar'},
|
||||||
|
{},
|
||||||
|
].each do |value|
|
||||||
|
describe value.inspect do
|
||||||
|
it { is_expected.to allow_value(value) }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'invalid types' do
|
||||||
|
context 'with garbage inputs' do
|
||||||
|
[
|
||||||
|
{'key' => 1},
|
||||||
|
{'fookey' => 'foo'},
|
||||||
|
'foo',
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
1,
|
||||||
|
1.1,
|
||||||
|
'<SERVICE DEFAULT>',
|
||||||
|
].each do |value|
|
||||||
|
describe value.inspect do
|
||||||
|
it { is_expected.not_to allow_value(value) }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
1
types/sshkey.pp
Normal file
1
types/sshkey.pp
Normal file
@@ -0,0 +1 @@
|
|||||||
|
type Nova::SshKey = Optional[Hash[Enum['key', 'type'], String[1]]]
|
Reference in New Issue
Block a user