Provide default service_name for keystone endpoint

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

Closes-bug: #1590040

Change-Id: I94d5429a21acea5d9fe8812f85fb65cfeb3094a3
This commit is contained in:
Venkata Mahesh Jonnalagadda 2016-06-02 06:32:50 -04:00
parent 6765d228d3
commit 87c7e5d22f
3 changed files with 14 additions and 26 deletions

View File

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

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

@ -39,10 +39,11 @@ describe 'mistral::keystone::auth' do
) }
end
describe 'when overriding auth name' do
describe 'when overriding auth and service name' do
let :params do
{ :password => 'foo',
:auth_name => 'mistraly' }
{ :service_name => 'mistraly',
:auth_name => 'mistraly',
:password => 'mistral_password' }
end
it { is_expected.to contain_keystone_user('mistraly') }
@ -51,19 +52,6 @@ describe 'mistral::keystone::auth' do
it { is_expected.to contain_keystone_endpoint('RegionOne/mistraly::workflowv2') }
end
describe 'when overriding service name' do
let :params do
{ :service_name => 'mistral_service',
:auth_name => 'mistral',
:password => 'mistral_password' }
end
it { is_expected.to contain_keystone_user('mistral') }
it { is_expected.to contain_keystone_user_role('mistral@services') }
it { is_expected.to contain_keystone_service('mistral_service::workflowv2') }
it { is_expected.to contain_keystone_endpoint('RegionOne/mistral_service::workflowv2') }
end
describe 'when disabling user configuration' do
let :params do