Browse Source

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
changes/93/720893/3
Takashi Kajinami 2 years ago
parent
commit
ae4390b9ed
  1. 71
      manifests/auth.pp
  2. 6
      releasenotes/notes/auth-domain_name-ad3d0cc86f0efccf.yaml
  3. 22
      spec/classes/aodh_auth_spec.rb

71
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;
}
}
}

6
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.

22
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 => '<SERVICE DEFAULT>')
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!(

Loading…
Cancel
Save