Provide default service_name for keystone endpoint

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

Additional changes:

* update related spec test
* add a release note
* add the service_description option in order to configure it

Change-Id: Iaca2fe1ec33041593ddc8ee9b7bd7a0cd31f1f3f
Closes-Bug: #1590040
This commit is contained in:
ZhongShengping 2016-06-12 16:37:27 +08:00
parent 930f1fcc59
commit 857ba17d39
3 changed files with 16 additions and 8 deletions

View File

@ -35,7 +35,7 @@
#
# [*service_name*]
# (optional) Name of the service.
# Defaults to the value of auth_name.
# Defaults to 'gnocchi'
#
# [*public_url*]
# (optional) The endpoint's public url. (Defaults to 'http://127.0.0.1:8041')
@ -49,6 +49,10 @@
# (optional) The endpoint's internal url. (Defaults to 'http://127.0.0.1:8041')
# This url should *not* contain any trailing '/'.
#
# [*service_description*]
# (Optional) Description for keystone service.
# Defaults to 'Openstack Metric Service'.
#
class gnocchi::keystone::auth (
$password,
$auth_name = 'gnocchi',
@ -57,23 +61,22 @@ class gnocchi::keystone::auth (
$configure_endpoint = true,
$configure_user = true,
$configure_user_role = true,
$service_name = undef,
$service_name = 'gnocchi',
$service_type = 'metric',
$region = 'RegionOne',
$public_url = 'http://127.0.0.1:8041',
$internal_url = 'http://127.0.0.1:8041',
$admin_url = 'http://127.0.0.1:8041',
$service_description = 'OpenStack Metric Service',
) {
$real_service_name = pick($service_name, $auth_name)
keystone::resource::service_identity { 'gnocchi':
configure_user => $configure_user,
configure_user_role => $configure_user_role,
configure_endpoint => $configure_endpoint,
service_name => $real_service_name,
service_name => $service_name,
service_type => $service_type,
service_description => 'OpenStack Metric Service',
service_description => $service_description,
region => $region,
auth_name => $auth_name,
password => $password,

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

@ -60,8 +60,8 @@ describe 'gnocchi::keystone::auth' do
it { is_expected.to contain_keystone_user('gnocchiany') }
it { is_expected.to contain_keystone_user_role('gnocchiany@services') }
it { is_expected.to contain_keystone_service('gnocchiany::metric') }
it { is_expected.to contain_keystone_endpoint('RegionOne/gnocchiany::metric') }
it { is_expected.to contain_keystone_service('gnocchi::metric') }
it { is_expected.to contain_keystone_endpoint('RegionOne/gnocchi::metric') }
end
context 'when overriding service name' do