Provide default service_name for keystone endpoint

This change updates the zaqar::keystone::auth class to include a default
service_name of 'zaqar' so that if a user changes the auth_name, the
service is still created as being related to 'zaqar'.  This improves the
user experiance when they want to customize the usernames for services.

Change-Id: I2977790c3558732c2a1773aa3ede834c1d62ca16
Closes-Bug: #1590040
This commit is contained in:
ZhongShengping 2016-06-08 13:52:19 +08:00
parent 3c49546f0a
commit c2acaba000
3 changed files with 12 additions and 12 deletions

View File

@ -43,7 +43,7 @@
# #
# [*service_name*] # [*service_name*]
# (optional) Name of the service. # (optional) Name of the service.
# Defaults to the value of auth_name. # Defaults to 'zaqar'
# #
# [*configure_service*] # [*configure_service*]
# Should zaqar service be configured? Defaults to 'true'. # Should zaqar service be configured? Defaults to 'true'.
@ -60,7 +60,7 @@ class zaqar::keystone::auth(
$password, $password,
$email = 'zaqar@localhost', $email = 'zaqar@localhost',
$auth_name = 'zaqar', $auth_name = 'zaqar',
$service_name = undef, $service_name = 'zaqar',
$service_type = 'messaging', $service_type = 'messaging',
$public_url = 'http://127.0.0.1:8888', $public_url = 'http://127.0.0.1:8888',
$admin_url = 'http://127.0.0.1:8888', $admin_url = 'http://127.0.0.1:8888',
@ -76,19 +76,14 @@ class zaqar::keystone::auth(
validate_string($password) validate_string($password)
if $service_name == undef { keystone::resource::service_identity { 'zaqar':
$real_service_name = $auth_name
} else {
$real_service_name = $service_name
}
keystone::resource::service_identity { $auth_name:
configure_user => $configure_user, configure_user => $configure_user,
configure_user_role => $configure_user_role, configure_user_role => $configure_user_role,
configure_endpoint => $configure_endpoint, configure_endpoint => $configure_endpoint,
service_type => $service_type, service_type => $service_type,
service_description => $service_description, service_description => $service_description,
service_name => $real_service_name, service_name => $service_name,
auth_name => $auth_name,
region => $region, region => $region,
password => $password, password => $password,
email => $email, email => $email,

View File

@ -0,0 +1,5 @@
---
fixes:
- The keystone auth class has been updated to provide a default service_name
to allow a user to specify a custom auth_name that may not contain the
name of the service.

View File

@ -62,8 +62,8 @@ describe 'zaqar::keystone::auth' do
it { is_expected.to contain_keystone_user('zaqary') } it { is_expected.to contain_keystone_user('zaqary') }
it { is_expected.to contain_keystone_user_role('zaqary@services') } it { is_expected.to contain_keystone_user_role('zaqary@services') }
it { is_expected.to contain_keystone_service('zaqary::messaging') } it { is_expected.to contain_keystone_service('zaqar::messaging') }
it { is_expected.to contain_keystone_endpoint('RegionOne/zaqary::messaging') } it { is_expected.to contain_keystone_endpoint('RegionOne/zaqar::messaging') }
end end
describe 'when overriding service name' do describe 'when overriding service name' do