Provide default service_name for keystone endpoint

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

Change-Id: I8c6240473213b107de862edf359834b5494e9f74
Closes-Bug: #1590040
This commit is contained in:
ZhongShengping 2016-06-08 14:10:25 +08:00
parent 8af1deb684
commit d9cd695e69
3 changed files with 12 additions and 7 deletions

View File

@ -9,7 +9,7 @@
#
# [*service_name*]
# (Optional) Name of the service.
# Defaults to the value of auth_name.
# Defaults to 'sahara'
#
# [*auth_name*]
# (Optional) Username for sahara service.
@ -66,7 +66,7 @@
#
class sahara::keystone::auth(
$password,
$service_name = undef,
$service_name = 'sahara',
$auth_name = 'sahara',
$email = 'sahara@localhost',
$tenant = 'services',
@ -79,14 +79,14 @@ class sahara::keystone::auth(
$internal_url = 'http://127.0.0.1:8386/v1.1/%(tenant_id)s',
) {
$real_service_name = pick($service_name, $auth_name)
keystone::resource::service_identity { $real_service_name:
keystone::resource::service_identity { 'sahara':
configure_user => true,
configure_user_role => true,
configure_endpoint => $configure_endpoint,
service_type => $service_type,
service_description => $service_description,
service_name => $service_name,
auth_name => $auth_name,
region => $region,
password => $password,
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

@ -73,7 +73,7 @@ describe 'sahara::keystone::auth' do
it { is_expected.to contain_keystone_user('saharay') }
it { is_expected.to contain_keystone_user_role('saharay@services') }
it { is_expected.to contain_keystone_service('saharay::data-processing') }
it { is_expected.to contain_keystone_endpoint('RegionOne/saharay::data-processing') }
it { is_expected.to contain_keystone_service('sahara::data-processing') }
it { is_expected.to contain_keystone_endpoint('RegionOne/sahara::data-processing') }
end
end