Provide default service_name for keystone endpoint

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

Closes-Bug: #1590040

Change-Id: Iee47e78dbeb269e5fe6c52030de378c13e51c1f3
This commit is contained in:
Venkata Mahesh Jonnalagadda 2016-06-02 14:50:52 -04:00
parent 14d456d875
commit 6f16641c4e
5 changed files with 29 additions and 24 deletions

View File

@ -32,7 +32,7 @@
#
# [*service_name*]
# (Optional) Name of the service.
# Defaults to the value of auth_name.
# Defaults to 'heat'.
#
# [*service_type*]
# (Optional) Type of service.
@ -97,7 +97,7 @@ class heat::keystone::auth (
$password = false,
$email = 'heat@localhost',
$auth_name = 'heat',
$service_name = undef,
$service_name = 'heat',
$service_type = 'orchestration',
$service_description = 'Openstack Orchestration Service',
$region = 'RegionOne',
@ -119,17 +119,16 @@ class heat::keystone::auth (
validate_string($password)
$real_service_name = pick($service_name, $auth_name)
keystone::resource::service_identity { $auth_name:
keystone::resource::service_identity { 'heat':
configure_user => $configure_user,
configure_user_role => $configure_user_role,
configure_endpoint => $configure_endpoint,
configure_service => $configure_service,
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

@ -32,7 +32,7 @@
#
# [*service_name*]
# (Optional) Name of the service.
# Defaults to the value of auth_name.
# Defaults to 'heat'.
#
# [*service_type*]
# (Optional) Type of service.
@ -70,7 +70,7 @@ class heat::keystone::auth_cfn (
$password = false,
$email = 'heat-cfn@localhost',
$auth_name = 'heat-cfn',
$service_name = undef,
$service_name = 'heat-cfn',
$service_type = 'cloudformation',
$region = 'RegionOne',
$tenant = 'services',
@ -87,17 +87,16 @@ class heat::keystone::auth_cfn (
validate_string($password)
$real_service_name = pick($service_name, $auth_name)
keystone::resource::service_identity { $auth_name:
keystone::resource::service_identity { 'heat-cfn':
configure_user => $configure_user,
configure_user_role => $configure_user_role,
configure_endpoint => $configure_endpoint,
configure_service => $configure_service,
service_type => $service_type,
service_description => 'Openstack Cloudformation Service',
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

@ -70,23 +70,24 @@ describe 'heat::keystone::auth_cfn' do
end
end
context 'when overriding service name' do
context 'when overriding auth and service name' do
before do
params.merge!({
:service_name => 'heat-cfn_service'
:auth_name => 'heat-cfny',
:service_name => 'heat-cfny'
})
end
it 'configures correct user name' do
is_expected.to contain_keystone_user('heat-cfn')
is_expected.to contain_keystone_user('heat-cfny')
end
it 'configures correct user role' do
is_expected.to contain_keystone_user_role('heat-cfn@services')
is_expected.to contain_keystone_user_role('heat-cfny@services')
end
it 'configures correct service name' do
is_expected.to contain_keystone_service('heat-cfn_service::cloudformation')
is_expected.to contain_keystone_service('heat-cfny::cloudformation')
end
it 'configures correct endpoint name' do
is_expected.to contain_keystone_endpoint('RegionOne/heat-cfn_service::cloudformation')
is_expected.to contain_keystone_endpoint('RegionOne/heat-cfny::cloudformation')
end
end

View File

@ -77,23 +77,24 @@ describe 'heat::keystone::auth' do
end
end
context 'when overriding service name' do
context 'when overriding auth and service name' do
before do
params.merge!({
:service_name => 'heat_service'
:auth_name => 'heaty',
:service_name => 'heaty'
})
end
it 'configures correct user name' do
is_expected.to contain_keystone_user('heat')
is_expected.to contain_keystone_user('heaty')
end
it 'configures correct user role' do
is_expected.to contain_keystone_user_role('heat@services')
is_expected.to contain_keystone_user_role('heaty@services')
end
it 'configures correct service name' do
is_expected.to contain_keystone_service('heat_service::orchestration')
is_expected.to contain_keystone_service('heaty::orchestration')
end
it 'configures correct endpoint name' do
is_expected.to contain_keystone_endpoint('RegionOne/heat_service::orchestration')
is_expected.to contain_keystone_endpoint('RegionOne/heaty::orchestration')
end
end