Merge "Accept system scope credential for Nova API request"
This commit is contained in:
commit
815d8ea913
@ -40,6 +40,10 @@
|
||||
# The name of project's domain (required for Identity V3).
|
||||
# Defaults to 'Default'
|
||||
#
|
||||
# [*system_scope*]
|
||||
# (Optional) Scope for system operations
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*region_name*]
|
||||
# (optional) Region name for connecting to nova in admin context
|
||||
# through the OpenStack Identity service.
|
||||
@ -61,19 +65,31 @@ class ironic::nova (
|
||||
$password = $::os_service_default,
|
||||
$user_domain_name = 'Default',
|
||||
$project_domain_name = 'Default',
|
||||
$system_scope = $::os_service_default,
|
||||
$region_name = $::os_service_default,
|
||||
$endpoint_override = $::os_service_default,
|
||||
$send_power_notifications = $::os_service_default,
|
||||
) {
|
||||
|
||||
include ironic::deps
|
||||
|
||||
if is_service_default($system_scope) {
|
||||
$project_name_real = $project_name
|
||||
$project_domain_name_real = $project_domain_name
|
||||
} else {
|
||||
$project_name_real = $::os_service_default
|
||||
$project_domain_name_real = $::os_service_default
|
||||
}
|
||||
|
||||
ironic_config {
|
||||
'nova/auth_type': value => $auth_type;
|
||||
'nova/username': value => $username;
|
||||
'nova/password': value => $password, secret => true;
|
||||
'nova/auth_url': value => $auth_url;
|
||||
'nova/project_name': value => $project_name;
|
||||
'nova/project_name': value => $project_name_real;
|
||||
'nova/user_domain_name': value => $user_domain_name;
|
||||
'nova/project_domain_name': value => $project_domain_name;
|
||||
'nova/project_domain_name': value => $project_domain_name_real;
|
||||
'nova/system_scope': value => $system_scope;
|
||||
'nova/region_name': value => $region_name;
|
||||
'nova/endpoint_override': value => $endpoint_override;
|
||||
'nova/send_power_notifications': value => $send_power_notifications;
|
||||
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
The new ``sysem_scope`` parameter has been added to the ``ironic::nova``
|
||||
class.
|
@ -41,6 +41,7 @@ describe 'ironic::nova' do
|
||||
is_expected.to contain_ironic_config('nova/password').with_value('<SERVICE DEFAULT>').with_secret(true)
|
||||
is_expected.to contain_ironic_config('nova/user_domain_name').with_value('Default')
|
||||
is_expected.to contain_ironic_config('nova/project_domain_name').with_value('Default')
|
||||
is_expected.to contain_ironic_config('nova/system_scope').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_ironic_config('nova/region_name').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_ironic_config('nova/endpoint_override').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_ironic_config('nova/send_power_notifications').with_value('<SERVICE DEFAULT>')
|
||||
@ -71,11 +72,25 @@ describe 'ironic::nova' do
|
||||
is_expected.to contain_ironic_config('nova/user_domain_name').with_value(p[:user_domain_name])
|
||||
is_expected.to contain_ironic_config('nova/project_domain_name').with_value(p[:project_domain_name])
|
||||
is_expected.to contain_ironic_config('nova/region_name').with_value(p[:region_name])
|
||||
is_expected.to contain_ironic_config('nova/system_scope').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_ironic_config('nova/endpoint_override').with_value(p[:endpoint_override])
|
||||
is_expected.to contain_ironic_config('nova/send_power_notifications').with_value(p[:send_power_notifications])
|
||||
end
|
||||
end
|
||||
|
||||
context 'when system_scope is set' do
|
||||
before :each do
|
||||
params.merge!(
|
||||
:system_scope => 'all',
|
||||
)
|
||||
end
|
||||
|
||||
it 'configures system-scoped credential' do
|
||||
is_expected.to contain_ironic_config('nova/project_name').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_ironic_config('nova/project_domain_name').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_ironic_config('nova/system_scope').with_value('all')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
|
Loading…
Reference in New Issue
Block a user