Merge "Add parameter types to openstack_extras::auth_file"
This commit is contained in:
@@ -1,2 +1 @@
|
||||
--no-parameter_types-check
|
||||
--no-strict_indent-check
|
||||
|
@@ -114,32 +114,32 @@
|
||||
# Defaults to undef.
|
||||
#
|
||||
class openstack_extras::auth_file (
|
||||
$password,
|
||||
$auth_url = 'http://127.0.0.1:5000/v3/',
|
||||
$service_token = undef,
|
||||
$service_endpoint = 'http://127.0.0.1:5000/v3/',
|
||||
$username = 'admin',
|
||||
$project_name = 'openstack',
|
||||
$region_name = 'RegionOne',
|
||||
$use_no_cache = true,
|
||||
$project_domain_name = 'Default',
|
||||
$user_domain_name = 'Default',
|
||||
$auth_type = undef,
|
||||
$os_interface = 'public',
|
||||
$os_endpoint_type = 'publicURL',
|
||||
$cinder_endpoint_type = 'publicURL',
|
||||
$glance_endpoint_type = 'publicURL',
|
||||
$keystone_endpoint_type = 'publicURL',
|
||||
$nova_endpoint_type = 'publicURL',
|
||||
$neutron_endpoint_type = 'publicURL',
|
||||
$auth_strategy = 'keystone',
|
||||
$path = '/root/openrc',
|
||||
$compute_api_version = undef,
|
||||
$network_api_version = undef,
|
||||
$image_api_version = undef,
|
||||
$volume_api_version = undef,
|
||||
$identity_api_version = '3',
|
||||
$object_api_version = undef,
|
||||
String[1] $password,
|
||||
Stdlib::HTTPUrl $auth_url = 'http://127.0.0.1:5000/v3/',
|
||||
Optional[String[1]] $service_token = undef,
|
||||
Stdlib::HTTPUrl $service_endpoint = 'http://127.0.0.1:5000/v3/',
|
||||
String[1] $username = 'admin',
|
||||
String[1] $project_name = 'openstack',
|
||||
String[1] $region_name = 'RegionOne',
|
||||
Boolean $use_no_cache = true,
|
||||
String[1] $project_domain_name = 'Default',
|
||||
String[1] $user_domain_name = 'Default',
|
||||
Optional[String[1]] $auth_type = undef,
|
||||
Openstack_extras::EndpointType $os_interface = 'public',
|
||||
Openstack_extras::EndpointType $os_endpoint_type = 'publicURL',
|
||||
Openstack_extras::EndpointType $cinder_endpoint_type = 'publicURL',
|
||||
Openstack_extras::EndpointType $glance_endpoint_type = 'publicURL',
|
||||
Openstack_extras::EndpointType $keystone_endpoint_type = 'publicURL',
|
||||
Openstack_extras::EndpointType $nova_endpoint_type = 'publicURL',
|
||||
Openstack_extras::EndpointType $neutron_endpoint_type = 'publicURL',
|
||||
String[1] $auth_strategy = 'keystone',
|
||||
Stdlib::Absolutepath $path = '/root/openrc',
|
||||
Optional[Openstack_extras::ApiVersion] $compute_api_version = undef,
|
||||
Optional[Openstack_extras::ApiVersion] $network_api_version = undef,
|
||||
Optional[Openstack_extras::ApiVersion] $image_api_version = undef,
|
||||
Optional[Openstack_extras::ApiVersion] $volume_api_version = undef,
|
||||
Openstack_extras::ApiVersion $identity_api_version = 3,
|
||||
Optional[Openstack_extras::ApiVersion] $object_api_version = undef,
|
||||
) {
|
||||
file { $path:
|
||||
ensure => file,
|
||||
|
@@ -49,7 +49,7 @@ EOS
|
||||
:username => 'myuser',
|
||||
:project_name => 'myproject',
|
||||
:region_name => 'myregion',
|
||||
:use_no_cache => 'false',
|
||||
:use_no_cache => false,
|
||||
:os_interface => 'internal',
|
||||
:os_endpoint_type => 'internalURL',
|
||||
:cinder_endpoint_type => 'internalURL',
|
||||
|
@@ -1,4 +1,8 @@
|
||||
if ENV.fetch('IMPLEMENTATION', 'puppet') == 'puppet'
|
||||
require 'puppetlabs_spec_helper/module_spec_helper'
|
||||
else
|
||||
require 'voxpupuli/test/spec_helper'
|
||||
end
|
||||
require 'shared_examples'
|
||||
require 'puppet-openstack_spec_helper/facts'
|
||||
|
||||
|
46
spec/type_aliases/apiversion_spec.rb
Normal file
46
spec/type_aliases/apiversion_spec.rb
Normal file
@@ -0,0 +1,46 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'Openstack_extras::ApiVersion' do
|
||||
describe 'valid types' do
|
||||
context 'with valid types' do
|
||||
[
|
||||
1,
|
||||
2,
|
||||
1.0,
|
||||
2.1,
|
||||
'1',
|
||||
'2',
|
||||
'1.0',
|
||||
'2.1',
|
||||
].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
|
||||
[
|
||||
nil,
|
||||
0,
|
||||
-1,
|
||||
0.9,
|
||||
-0.1,
|
||||
false,
|
||||
'',
|
||||
'-1',
|
||||
'-1.0',
|
||||
'0.9',
|
||||
'1.1.2',
|
||||
'1.1a',
|
||||
'<SERVICE DEFAULT>',
|
||||
].each do |value|
|
||||
describe value.inspect do
|
||||
it { is_expected.not_to allow_value(value) }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
39
spec/type_aliases/endpointtype_spec.rb
Normal file
39
spec/type_aliases/endpointtype_spec.rb
Normal file
@@ -0,0 +1,39 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'Openstack_extras::EndpointType' do
|
||||
describe 'valid types' do
|
||||
context 'with valid types' do
|
||||
[
|
||||
'public',
|
||||
'internal',
|
||||
'admin',
|
||||
'publicURL',
|
||||
'internalURL',
|
||||
'adminURL',
|
||||
].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
|
||||
[
|
||||
nil,
|
||||
0,
|
||||
false,
|
||||
'',
|
||||
'unknown',
|
||||
['public'],
|
||||
{'public' => 'public'},
|
||||
'<SERVICE DEFAULT>',
|
||||
].each do |value|
|
||||
describe value.inspect do
|
||||
it { is_expected.not_to allow_value(value) }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
5
types/apiversion.pp
Normal file
5
types/apiversion.pp
Normal file
@@ -0,0 +1,5 @@
|
||||
type Openstack_extras::ApiVersion = Variant[
|
||||
Integer[1],
|
||||
Float[1],
|
||||
Pattern[/^[1-9]\d*(\.\d+)?$/],
|
||||
]
|
8
types/endpointtype.pp
Normal file
8
types/endpointtype.pp
Normal file
@@ -0,0 +1,8 @@
|
||||
type Openstack_extras::EndpointType = Enum[
|
||||
'public',
|
||||
'internal',
|
||||
'admin',
|
||||
'publicURL',
|
||||
'internalURL',
|
||||
'adminURL',
|
||||
]
|
Reference in New Issue
Block a user