Provide default service_name for keystone endpoint

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

Closes-bug: #1590040
Change-Id: I031103fe611d176dcbddf665bd2e66e230610c91
This commit is contained in:
Venkata Mahesh Jonnalagadda 2016-06-02 14:16:23 -04:00
parent 28a68de3bf
commit 65ece2453b
5 changed files with 23 additions and 14 deletions

View File

@ -9,7 +9,7 @@
#
# [*service_name*]
# (Optional) Name of the service.
# Defaults to the value of auth_name.
# Defaults to 'murano'.
#
# [*auth_name*]
# (Optional) Username for murano service.
@ -62,7 +62,7 @@
#
class murano::keystone::auth(
$password,
$service_name = undef,
$service_name = 'murano',
$auth_name = 'murano',
$email = 'murano@localhost',
$tenant = 'services',
@ -75,15 +75,15 @@ class murano::keystone::auth(
$internal_url = 'http://127.0.0.1:8082',
) {
$real_service_name = pick($service_name, $auth_name)
keystone::resource::service_identity { $real_service_name:
keystone::resource::service_identity { 'murano':
configure_user => true,
configure_user_role => true,
configure_endpoint => $configure_endpoint,
service_name => $service_name,
service_type => $service_type,
service_description => $service_description,
region => $region,
auth_name => $auth_name,
password => $password,
email => $email,
tenant => $tenant,

View File

@ -9,7 +9,7 @@
#
# [*service_name*]
# (Optional) Name of the service.
# Defaults to the value of auth_name.
# Defaults to 'murano-cfapi'.
#
# [*auth_name*]
# (Optional) Username for murano service.
@ -62,7 +62,7 @@
#
class murano::keystone::cfapi_auth(
$password,
$service_name = undef,
$service_name = 'murano-cfapi',
$auth_name = 'murano-cfapi',
$email = 'murano@localhost',
$tenant = 'services',
@ -75,15 +75,16 @@ class murano::keystone::cfapi_auth(
$internal_url = 'http://127.0.0.1:8083',
) {
$real_service_name = pick($service_name, $auth_name)
keystone::resource::service_identity { $real_service_name:
keystone::resource::service_identity { 'murano-cfapi':
configure_user => false,
configure_user_role => false,
configure_endpoint => $configure_endpoint,
service_name => $service_name,
service_type => $service_type,
service_description => $service_description,
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

@ -51,9 +51,10 @@ describe 'murano::keystone::auth' do
) }
end
describe 'when overriding auth name' do
describe 'when overriding auth and service name' do
let :params do
{ :password => 'foo',
:service_name => 'muranoy',
:auth_name => 'muranoy' }
end
@ -62,4 +63,5 @@ describe 'murano::keystone::auth' do
it { is_expected.to contain_keystone_service('muranoy::application-catalog') }
it { is_expected.to contain_keystone_endpoint('RegionOne/muranoy::application-catalog') }
end
end

View File

@ -41,13 +41,14 @@ describe 'murano::keystone::cfapi_auth' do
) }
end
describe 'when overriding auth name' do
describe 'when overriding service name' do
let :params do
{ :password => 'foo',
:auth_name => 'muranoy' }
:service_name => 'murano-cfapiy' }
end
it { is_expected.to contain_keystone_service('muranoy::service-broker') }
it { is_expected.to contain_keystone_endpoint('RegionOne/muranoy::service-broker') }
it { is_expected.to contain_keystone_service('murano-cfapiy::service-broker') }
it { is_expected.to contain_keystone_endpoint('RegionOne/murano-cfapiy::service-broker') }
end
end