From ae4390b9edc6548fb8d2d6521f936f7f985c869d Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Sat, 18 Apr 2020 23:56:55 +0900 Subject: [PATCH] Use domain_name instead of domain_id ... because domain name is more predictable than domain id. Also, we generally use domain_name instead of domain_id in other puppet modules, so it's more consistent to use domain_name. Change-Id: I3439997795b7331eec0d0a0a0568d6afdeb5247b --- manifests/auth.pp | 71 ++++++++++++++----- .../auth-domain_name-ad3d0cc86f0efccf.yaml | 6 ++ spec/classes/aodh_auth_spec.rb | 22 +++++- 3 files changed, 79 insertions(+), 20 deletions(-) create mode 100644 releasenotes/notes/auth-domain_name-ad3d0cc86f0efccf.yaml diff --git a/manifests/auth.pp b/manifests/auth.pp index 9539d674..830ea65c 100644 --- a/manifests/auth.pp +++ b/manifests/auth.pp @@ -21,13 +21,13 @@ # the keystone tenant name for aodh services # Optional. Defaults to 'services' # -# [*project_domain_id*] -# the keystone project domain id for aodh services -# Optional. Defaults to 'default' +# [*project_domain_name*] +# the keystone project domain name for aodh services +# Optional. Defaults to 'Default' # -# [*user_domain_id*] -# the keystone user domain id for aodh services -# Optional. Defaults to 'default' +# [*user_domain_name*] +# the keystone user domain name for aodh services +# Optional. Defaults to 'Default' # # [*auth_tenant_id*] # the keystone tenant id for aodh services. @@ -47,18 +47,31 @@ # communication with OpenStack services. # Optional. Defaults to $::os_service_default. # +# DEPRECATED PARAMETERS +# +# [*project_domain_id*] +# the keystone project domain id for aodh services +# Optional. Defaults to undef +# +# [*user_domain_id*] +# the keystone user domain id for aodh services +# Optional. Defaults to undef +# class aodh::auth ( $auth_password, - $auth_url = 'http://localhost:5000/v3', - $auth_region = 'RegionOne', - $auth_user = 'aodh', - $auth_tenant_name = 'services', - $project_domain_id = 'default', - $user_domain_id = 'default', - $auth_type = 'password', - $auth_tenant_id = $::os_service_default, - $auth_cacert = $::os_service_default, - $interface = $::os_service_default, + $auth_url = 'http://localhost:5000/v3', + $auth_region = 'RegionOne', + $auth_user = 'aodh', + $auth_tenant_name = 'services', + $project_domain_name = 'Default', + $user_domain_name = 'Default', + $auth_type = 'password', + $auth_tenant_id = $::os_service_default, + $auth_cacert = $::os_service_default, + $interface = $::os_service_default, + # DEPRECATED PARAMETERS + $project_domain_id = undef, + $user_domain_id = undef, ) { include aodh::deps @@ -72,9 +85,31 @@ class aodh::auth ( 'service_credentials/cacert' : value => $auth_cacert; 'service_credentials/tenant_id' : value => $auth_tenant_id; 'service_credentials/interface' : value => $interface; - 'service_credentials/project_domain_id' : value => $project_domain_id; - 'service_credentials/user_domain_id' : value => $user_domain_id; 'service_credentials/auth_type' : value => $auth_type; } + if $project_domain_id != undef { + warning('aodh::auth::project_domain_id is deprecated and will be removed \ +in a future release. Use project_domain_name instead.') + aodh_config{ + 'service_credentials/project_domain_id' : value => $project_domain_id; + } + } else { + aodh_config{ + 'service_credentials/project_domain_name' : value => $project_domain_name; + } + } + + if $user_domain_id != undef { + warning('aodh::auth::user_domain_id is deprecated and will be removed \ +in a future release. Use user_domain_name instead.') + aodh_config{ + 'service_credentials/user_domain_id' : value => $user_domain_id; + } + } else { + aodh_config{ + 'service_credentials/user_domain_name' : value => $user_domain_name; + } + } + } diff --git a/releasenotes/notes/auth-domain_name-ad3d0cc86f0efccf.yaml b/releasenotes/notes/auth-domain_name-ad3d0cc86f0efccf.yaml new file mode 100644 index 00000000..5928199b --- /dev/null +++ b/releasenotes/notes/auth-domain_name-ad3d0cc86f0efccf.yaml @@ -0,0 +1,6 @@ +--- +deprecations: + - | + ``user_domain_id`` and ``project_domain_id`` in ``aodh::auth`` class were + deprecated and will be removed in a future release. Use + ``user_domain_name`` and ``project_domain_name`` instead. diff --git a/spec/classes/aodh_auth_spec.rb b/spec/classes/aodh_auth_spec.rb index 4b8e7f39..0f6cfbc8 100644 --- a/spec/classes/aodh_auth_spec.rb +++ b/spec/classes/aodh_auth_spec.rb @@ -16,8 +16,10 @@ describe 'aodh::auth' do it 'configures authentication' do is_expected.to contain_aodh_config('service_credentials/auth_url').with_value('http://localhost:5000/v3') is_expected.to contain_aodh_config('service_credentials/region_name').with_value('RegionOne') - is_expected.to contain_aodh_config('service_credentials/project_domain_id').with_value('default') - is_expected.to contain_aodh_config('service_credentials/user_domain_id').with_value('default') + is_expected.to contain_aodh_config('service_credentials/project_domain_name').with_value('Default') + is_expected.to_not contain_aodh_config('service_credentials/project_domain_id') + is_expected.to contain_aodh_config('service_credentials/user_domain_name').with_value('Default') + is_expected.to_not contain_aodh_config('service_credentials/user_domain_id') is_expected.to contain_aodh_config('service_credentials/auth_type').with_value('password') is_expected.to contain_aodh_config('service_credentials/username').with_value('aodh') is_expected.to contain_aodh_config('service_credentials/password').with_value('password').with_secret(true) @@ -25,6 +27,22 @@ describe 'aodh::auth' do is_expected.to contain_aodh_config('service_credentials/cacert').with(:value => '') end + context 'when deprecated domain_id is set' do + before do + params.merge!( + :user_domain_id => 'default', + :project_domain_id => 'default', + ) + end + + it 'configures domain_id instead of domain_name' do + is_expected.to_not contain_aodh_config('service_credentials/project_domain_name') + is_expected.to contain_aodh_config('service_credentials/project_domain_id').with_value('default') + is_expected.to_not contain_aodh_config('service_credentials/user_domain_name') + is_expected.to contain_aodh_config('service_credentials/user_domain_id').with_value('default') + end + end + context 'when overriding parameters' do before do params.merge!(