limit: Add default service_name/type
Add default service_name/type according to the default values in glance::keystone::auth, to reduce the required parameters to enable the unified limit feature. Change-Id: Ie650cbb0a3d7da7a1235ffbd6fb52a3c6c0df6ae
This commit is contained in:
@@ -75,8 +75,8 @@
|
||||
class glance::limit(
|
||||
String[1] $password,
|
||||
Optional[String[1]] $endpoint_id = undef,
|
||||
Optional[String[1]] $endpoint_service_name = undef,
|
||||
Optional[String[1]] $endpoint_service_type = undef,
|
||||
String[1] $endpoint_service_name = 'glance',
|
||||
String[1] $endpoint_service_type = 'image',
|
||||
$endpoint_region_name = $facts['os_service_default'],
|
||||
$endpoint_interface = $facts['os_service_default'],
|
||||
$username = 'glance',
|
||||
@@ -94,10 +94,18 @@ class glance::limit(
|
||||
|
||||
include glance::deps
|
||||
|
||||
if $endpoint_id != undef {
|
||||
$endpoint_service_name_real = undef
|
||||
$endpoint_service_type_real = undef
|
||||
} else {
|
||||
$endpoint_service_name_real = $endpoint_service_name
|
||||
$endpoint_service_type_real = $endpoint_service_type
|
||||
}
|
||||
|
||||
oslo::limit { 'glance_api_config':
|
||||
endpoint_id => $endpoint_id,
|
||||
endpoint_service_name => $endpoint_service_name,
|
||||
endpoint_service_type => $endpoint_service_type,
|
||||
endpoint_service_name => $endpoint_service_name_real,
|
||||
endpoint_service_type => $endpoint_service_type_real,
|
||||
endpoint_region_name => $endpoint_region_name,
|
||||
endpoint_interface => $endpoint_interface,
|
||||
username => $username,
|
||||
|
@@ -10,6 +10,30 @@ describe 'glance::limit' do
|
||||
}
|
||||
end
|
||||
|
||||
context 'without endpoint_id' do
|
||||
it 'configure limit default params' do
|
||||
is_expected.to contain_oslo__limit('glance_api_config').with(
|
||||
:endpoint_id => nil,
|
||||
:endpoint_service_name => 'glance',
|
||||
:endpoint_service_type => 'image',
|
||||
:endpoint_region_name => '<SERVICE DEFAULT>',
|
||||
:endpoint_interface => '<SERVICE DEFAULT>',
|
||||
:username => 'glance',
|
||||
:password => 'glance_password',
|
||||
:auth_url => 'http://localhost:5000',
|
||||
:project_name => 'services',
|
||||
:user_domain_name => 'Default',
|
||||
:project_domain_name => 'Default',
|
||||
:system_scope => '<SERVICE DEFAULT>',
|
||||
:auth_type => 'password',
|
||||
:service_type => '<SERVICE DEFAULT>',
|
||||
:valid_interfaces => '<SERVICE DEFAULT>',
|
||||
:region_name => '<SERVICE DEFAULT>',
|
||||
:endpoint_override => '<SERVICE DEFAULT>',
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with endpoint_id' do
|
||||
before :each do
|
||||
params.merge!({
|
||||
@@ -38,10 +62,13 @@ describe 'glance::limit' do
|
||||
:endpoint_override => '<SERVICE DEFAULT>',
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with specific parameters' do
|
||||
before :each do
|
||||
params.merge!({
|
||||
:endpoint_service_name => 'alt_glance',
|
||||
:endpoint_service_type => 'alt_image',
|
||||
:endpoint_region_name => 'regionOne',
|
||||
:endpoint_interface => 'public',
|
||||
:username => 'alt_glance',
|
||||
@@ -60,9 +87,9 @@ describe 'glance::limit' do
|
||||
|
||||
it 'configure limit params' do
|
||||
is_expected.to contain_oslo__limit('glance_api_config').with(
|
||||
:endpoint_id => 'b41eeaed-d2ae-4add-9bfd-9ea8ac912d64',
|
||||
:endpoint_service_name => nil,
|
||||
:endpoint_service_type => nil,
|
||||
:endpoint_id => nil,
|
||||
:endpoint_service_name => 'alt_glance',
|
||||
:endpoint_service_type => 'alt_image',
|
||||
:endpoint_region_name => 'regionOne',
|
||||
:endpoint_interface => 'public',
|
||||
:username => 'alt_glance',
|
||||
@@ -82,67 +109,6 @@ describe 'glance::limit' do
|
||||
end
|
||||
end
|
||||
|
||||
context 'with endpoint_service_name' do
|
||||
before :each do
|
||||
params.merge!({
|
||||
:endpoint_service_name => 'glance',
|
||||
})
|
||||
end
|
||||
|
||||
it 'configure limit default params' do
|
||||
is_expected.to contain_oslo__limit('glance_api_config').with(
|
||||
:endpoint_id => nil,
|
||||
:endpoint_service_name => 'glance',
|
||||
:endpoint_service_type => nil,
|
||||
:endpoint_region_name => '<SERVICE DEFAULT>',
|
||||
:endpoint_interface => '<SERVICE DEFAULT>',
|
||||
:username => 'glance',
|
||||
:password => 'glance_password',
|
||||
:auth_url => 'http://localhost:5000',
|
||||
:project_name => 'services',
|
||||
:user_domain_name => 'Default',
|
||||
:project_domain_name => 'Default',
|
||||
:system_scope => '<SERVICE DEFAULT>',
|
||||
:auth_type => 'password',
|
||||
:service_type => '<SERVICE DEFAULT>',
|
||||
:valid_interfaces => '<SERVICE DEFAULT>',
|
||||
:region_name => '<SERVICE DEFAULT>',
|
||||
:endpoint_override => '<SERVICE DEFAULT>',
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with endpoint_service_type' do
|
||||
before :each do
|
||||
params.merge!({
|
||||
:endpoint_service_type => 'image',
|
||||
})
|
||||
end
|
||||
|
||||
it 'configure limit default params' do
|
||||
is_expected.to contain_oslo__limit('glance_api_config').with(
|
||||
:endpoint_id => nil,
|
||||
:endpoint_service_name => nil,
|
||||
:endpoint_service_type => 'image',
|
||||
:endpoint_region_name => '<SERVICE DEFAULT>',
|
||||
:endpoint_interface => '<SERVICE DEFAULT>',
|
||||
:username => 'glance',
|
||||
:password => 'glance_password',
|
||||
:auth_url => 'http://localhost:5000',
|
||||
:project_name => 'services',
|
||||
:user_domain_name => 'Default',
|
||||
:project_domain_name => 'Default',
|
||||
:system_scope => '<SERVICE DEFAULT>',
|
||||
:auth_type => 'password',
|
||||
:service_type => '<SERVICE DEFAULT>',
|
||||
:valid_interfaces => '<SERVICE DEFAULT>',
|
||||
:region_name => '<SERVICE DEFAULT>',
|
||||
:endpoint_override => '<SERVICE DEFAULT>',
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
|
Reference in New Issue
Block a user