Set credential parameters when auth_type != password

Currently the cinder::nova class ignores credential parameters like
username, but it causes the problem with some other "auth_type"s like
v3password, which require these credential parameters.

This change makes sure that all credential parameters are set
regardless of auth_type value.

Change-Id: I3cd1ba2ca0214383a5b114360e8de266e8eb0693
This commit is contained in:
Takashi Kajinami 2020-08-22 21:05:59 +09:00
parent e5152016e3
commit 91c3823cca
3 changed files with 32 additions and 33 deletions

View File

@ -69,7 +69,7 @@
#
# [*password*]
# (Optional) Nova admin password.
# Defaults to undef
# Defaults to $::os_service_default
#
# [*project_name*]
# (Optional) Nova admin project name.
@ -95,7 +95,7 @@ class cinder::nova (
$auth_url = $::os_service_default,
$username = 'nova',
$user_domain_name = 'Default',
$password = undef,
$password = $::os_service_default,
$project_name = 'services',
$project_domain_name = 'Default',
) {
@ -103,28 +103,23 @@ class cinder::nova (
include cinder::deps
cinder_config {
'nova/region_name': value => $region_name;
'nova/interface': value => $interface;
'nova/token_auth_url': value => $token_auth_url;
'nova/cafile': value => $cafile;
'nova/certfile': value => $certfile;
'nova/keyfile': value => $keyfile;
'nova/insecure': value => $insecure;
'nova/timeout': value => $timeout;
'nova/collect_timing': value => $collect_timing;
'nova/split_loggers': value => $split_loggers;
'nova/auth_type': value => $auth_type;
'nova/auth_section': value => $auth_section;
}
if $auth_type == 'password' {
cinder_config {
'nova/auth_url': value => $auth_url;
'nova/username': value => $username;
'nova/user_domain_name': value => $user_domain_name;
'nova/password': value => $password, secret => true;
'nova/project_name': value => $project_name;
'nova/project_domain_name': value => $project_domain_name;
}
'nova/region_name': value => $region_name;
'nova/interface': value => $interface;
'nova/token_auth_url': value => $token_auth_url;
'nova/cafile': value => $cafile;
'nova/certfile': value => $certfile;
'nova/keyfile': value => $keyfile;
'nova/insecure': value => $insecure;
'nova/timeout': value => $timeout;
'nova/collect_timing': value => $collect_timing;
'nova/split_loggers': value => $split_loggers;
'nova/auth_type': value => $auth_type;
'nova/auth_section': value => $auth_section;
'nova/auth_url': value => $auth_url;
'nova/username': value => $username;
'nova/user_domain_name': value => $user_domain_name;
'nova/password': value => $password, secret => true;
'nova/project_name': value => $project_name;
'nova/project_domain_name': value => $project_domain_name;
}
}

View File

@ -0,0 +1,6 @@
---
fixes:
- |
Now the ``cinder::nova`` class set credential parameters like username even
if auth_type is not ``password``. This fixes the problem with the other
auth_type value like ``v3password``.

View File

@ -16,14 +16,12 @@ describe 'cinder::nova' do
is_expected.to contain_cinder_config('nova/split_loggers').with_value('<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('nova/auth_type').with_value('<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('nova/auth_section').with_value('<SERVICE DEFAULT>')
# These should be added only when auth_type is 'password'
is_expected.not_to contain_cinder_config('nova/auth_url')
is_expected.not_to contain_cinder_config('nova/username')
is_expected.not_to contain_cinder_config('nova/user_domain_name')
is_expected.not_to contain_cinder_config('nova/password')
is_expected.not_to contain_cinder_config('nova/project_name')
is_expected.not_to contain_cinder_config('nova/project_domain_name')
is_expected.to contain_cinder_config('nova/auth_url').with_value('<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('nova/username').with_value('nova')
is_expected.to contain_cinder_config('nova/user_domain_name').with_value('Default')
is_expected.to contain_cinder_config('nova/password').with_value('<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('nova/project_name').with_value('services')
is_expected.to contain_cinder_config('nova/project_domain_name').with_value('Default')
}
end