limit: Add default service_name/type
Add default service_name/type according to the default values in nova::keystone::auth, to reduce the required parameters to enable the unified limit feature. Change-Id: I7cd83b05a871dab3bc1931c1cd18cef4df80c4a6
This commit is contained in:
parent
143ba1e0bf
commit
43fd445bfe
@ -13,11 +13,11 @@
|
|||||||
#
|
#
|
||||||
# [*endpoint_service_name*]
|
# [*endpoint_service_name*]
|
||||||
# (Optional) Service name for endpoint discovery
|
# (Optional) Service name for endpoint discovery
|
||||||
# Defaults to undef
|
# Defaults to 'nova'
|
||||||
#
|
#
|
||||||
# [*endpoint_service_type*]
|
# [*endpoint_service_type*]
|
||||||
# (Optional) Service type for endpoint discovery
|
# (Optional) Service type for endpoint discovery
|
||||||
# Defaults to undef
|
# Defaults to 'compute'
|
||||||
#
|
#
|
||||||
# [*endpoint_region_name*]
|
# [*endpoint_region_name*]
|
||||||
# (Optional) Region to which the endpoint belongs.
|
# (Optional) Region to which the endpoint belongs.
|
||||||
@ -74,30 +74,38 @@
|
|||||||
#
|
#
|
||||||
class nova::limit(
|
class nova::limit(
|
||||||
String[1] $password,
|
String[1] $password,
|
||||||
Optional[String[1]] $endpoint_id = undef,
|
Optional[String[1]] $endpoint_id = undef,
|
||||||
Optional[String[1]] $endpoint_service_name = undef,
|
String[1] $endpoint_service_name = 'nova',
|
||||||
Optional[String[1]] $endpoint_service_type = undef,
|
String[1] $endpoint_service_type = 'compute',
|
||||||
$endpoint_region_name = $facts['os_service_default'],
|
$endpoint_region_name = $facts['os_service_default'],
|
||||||
$endpoint_interface = $facts['os_service_default'],
|
$endpoint_interface = $facts['os_service_default'],
|
||||||
$username = 'nova',
|
$username = 'nova',
|
||||||
$auth_url = 'http://localhost:5000',
|
$auth_url = 'http://localhost:5000',
|
||||||
$project_name = 'services',
|
$project_name = 'services',
|
||||||
$user_domain_name = 'Default',
|
$user_domain_name = 'Default',
|
||||||
$project_domain_name = 'Default',
|
$project_domain_name = 'Default',
|
||||||
$system_scope = $facts['os_service_default'],
|
$system_scope = $facts['os_service_default'],
|
||||||
$auth_type = 'password',
|
$auth_type = 'password',
|
||||||
$service_type = $facts['os_service_default'],
|
$service_type = $facts['os_service_default'],
|
||||||
$valid_interfaces = $facts['os_service_default'],
|
$valid_interfaces = $facts['os_service_default'],
|
||||||
$region_name = $facts['os_service_default'],
|
$region_name = $facts['os_service_default'],
|
||||||
$endpoint_override = $facts['os_service_default'],
|
$endpoint_override = $facts['os_service_default'],
|
||||||
) {
|
) {
|
||||||
|
|
||||||
include nova::deps
|
include nova::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 { 'nova_config':
|
oslo::limit { 'nova_config':
|
||||||
endpoint_id => $endpoint_id,
|
endpoint_id => $endpoint_id,
|
||||||
endpoint_service_name => $endpoint_service_name,
|
endpoint_service_name => $endpoint_service_name_real,
|
||||||
endpoint_service_type => $endpoint_service_type,
|
endpoint_service_type => $endpoint_service_type_real,
|
||||||
endpoint_region_name => $endpoint_region_name,
|
endpoint_region_name => $endpoint_region_name,
|
||||||
endpoint_interface => $endpoint_interface,
|
endpoint_interface => $endpoint_interface,
|
||||||
username => $username,
|
username => $username,
|
||||||
|
@ -10,6 +10,30 @@ describe 'nova::limit' do
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'without endpoint_id' do
|
||||||
|
it 'configure limit default params' do
|
||||||
|
is_expected.to contain_oslo__limit('nova_config').with(
|
||||||
|
:endpoint_id => nil,
|
||||||
|
:endpoint_service_name => 'nova',
|
||||||
|
:endpoint_service_type => 'compute',
|
||||||
|
:endpoint_region_name => '<SERVICE DEFAULT>',
|
||||||
|
:endpoint_interface => '<SERVICE DEFAULT>',
|
||||||
|
:username => 'nova',
|
||||||
|
:password => 'nova_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
|
context 'with endpoint_id' do
|
||||||
before :each do
|
before :each do
|
||||||
params.merge!({
|
params.merge!({
|
||||||
@ -38,106 +62,48 @@ describe 'nova::limit' do
|
|||||||
:endpoint_override => '<SERVICE DEFAULT>',
|
:endpoint_override => '<SERVICE DEFAULT>',
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with specific parameters' do
|
|
||||||
before :each do
|
|
||||||
params.merge!({
|
|
||||||
:endpoint_region_name => 'regionOne',
|
|
||||||
:endpoint_interface => 'public',
|
|
||||||
:username => 'alt_nova',
|
|
||||||
:auth_url => 'http://192.168.0.1:5000',
|
|
||||||
:project_name => 'alt_services',
|
|
||||||
:user_domain_name => 'domainX',
|
|
||||||
:project_domain_name => 'domainX',
|
|
||||||
:system_scope => 'all',
|
|
||||||
:auth_type => 'v3password',
|
|
||||||
:service_type => 'identity',
|
|
||||||
:valid_interfaces => 'public',
|
|
||||||
:region_name => 'regionOne',
|
|
||||||
:endpoint_override => 'http://192.168.0.2:5000',
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'configure limit params' do
|
|
||||||
is_expected.to contain_oslo__limit('nova_config').with(
|
|
||||||
:endpoint_id => 'b41eeaed-d2ae-4add-9bfd-9ea8ac912d64',
|
|
||||||
:endpoint_service_name => nil,
|
|
||||||
:endpoint_service_type => nil,
|
|
||||||
:endpoint_region_name => 'regionOne',
|
|
||||||
:endpoint_interface => 'public',
|
|
||||||
:username => 'alt_nova',
|
|
||||||
:password => 'nova_password',
|
|
||||||
:auth_url => 'http://192.168.0.1:5000',
|
|
||||||
:project_name => 'alt_services',
|
|
||||||
:user_domain_name => 'domainX',
|
|
||||||
:project_domain_name => 'domainX',
|
|
||||||
:system_scope => 'all',
|
|
||||||
:auth_type => 'v3password',
|
|
||||||
:service_type => 'identity',
|
|
||||||
:valid_interfaces => 'public',
|
|
||||||
:region_name => 'regionOne',
|
|
||||||
:endpoint_override => 'http://192.168.0.2:5000',
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with endpoint_service_name' do
|
context 'with specific parameters' do
|
||||||
before :each do
|
before :each do
|
||||||
params.merge!({
|
params.merge!({
|
||||||
:endpoint_service_name => 'nova',
|
:endpoint_service_name => 'alt_nova',
|
||||||
|
:endpoint_service_type => 'alt_compute',
|
||||||
|
:endpoint_region_name => 'regionOne',
|
||||||
|
:endpoint_interface => 'public',
|
||||||
|
:username => 'alt_nova',
|
||||||
|
:auth_url => 'http://192.168.0.1:5000',
|
||||||
|
:project_name => 'alt_services',
|
||||||
|
:user_domain_name => 'domainX',
|
||||||
|
:project_domain_name => 'domainX',
|
||||||
|
:system_scope => 'all',
|
||||||
|
:auth_type => 'v3password',
|
||||||
|
:service_type => 'identity',
|
||||||
|
:valid_interfaces => 'public',
|
||||||
|
:region_name => 'regionOne',
|
||||||
|
:endpoint_override => 'http://192.168.0.2:5000',
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'configure limit default params' do
|
it 'configure limit params' do
|
||||||
is_expected.to contain_oslo__limit('nova_config').with(
|
is_expected.to contain_oslo__limit('nova_config').with(
|
||||||
:endpoint_id => nil,
|
:endpoint_id => nil,
|
||||||
:endpoint_service_name => 'nova',
|
:endpoint_service_name => 'alt_nova',
|
||||||
:endpoint_service_type => nil,
|
:endpoint_service_type => 'alt_compute',
|
||||||
:endpoint_region_name => '<SERVICE DEFAULT>',
|
:endpoint_region_name => 'regionOne',
|
||||||
:endpoint_interface => '<SERVICE DEFAULT>',
|
:endpoint_interface => 'public',
|
||||||
:username => 'nova',
|
:username => 'alt_nova',
|
||||||
:password => 'nova_password',
|
:password => 'nova_password',
|
||||||
:auth_url => 'http://localhost:5000',
|
:auth_url => 'http://192.168.0.1:5000',
|
||||||
:project_name => 'services',
|
:project_name => 'alt_services',
|
||||||
:user_domain_name => 'Default',
|
:user_domain_name => 'domainX',
|
||||||
:project_domain_name => 'Default',
|
:project_domain_name => 'domainX',
|
||||||
:system_scope => '<SERVICE DEFAULT>',
|
:system_scope => 'all',
|
||||||
:auth_type => 'password',
|
:auth_type => 'v3password',
|
||||||
:service_type => '<SERVICE DEFAULT>',
|
:service_type => 'identity',
|
||||||
:valid_interfaces => '<SERVICE DEFAULT>',
|
:valid_interfaces => 'public',
|
||||||
:region_name => '<SERVICE DEFAULT>',
|
:region_name => 'regionOne',
|
||||||
:endpoint_override => '<SERVICE DEFAULT>',
|
:endpoint_override => 'http://192.168.0.2:5000',
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'with endpoint_service_type' do
|
|
||||||
before :each do
|
|
||||||
params.merge!({
|
|
||||||
:endpoint_service_type => 'compute',
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'configure limit default params' do
|
|
||||||
is_expected.to contain_oslo__limit('nova_config').with(
|
|
||||||
:endpoint_id => nil,
|
|
||||||
:endpoint_service_name => nil,
|
|
||||||
:endpoint_service_type => 'compute',
|
|
||||||
:endpoint_region_name => '<SERVICE DEFAULT>',
|
|
||||||
:endpoint_interface => '<SERVICE DEFAULT>',
|
|
||||||
:username => 'nova',
|
|
||||||
:password => 'nova_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
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user