Update keystone::auth service name parameter

To be consistent and allow for username changes for services that may
not have the service name itself in, we need to provide the default
service name as a parameter when configuring the keystone information.
This change updates the cookiecutter keystone auth class to set the
service_name to the project name by default.

Change-Id: I542fcb873250f10cd003fe3d981ea63efa729c1b
Related-Bug: #1590040
This commit is contained in:
Alex Schultz 2016-06-07 10:32:37 -06:00
parent e66270f91b
commit ddfa8b583c
2 changed files with 6 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 the value of '{{cookiecutter.project_name}}'.
#
# [*service_description*]
# (optional) Description of the service.
@ -60,7 +60,7 @@ class {{cookiecutter.project_name}}::keystone::auth (
$configure_endpoint = true,
$configure_user = true,
$configure_user_role = true,
$service_name = undef,
$service_name = '{{cookiecutter.project_name}}',
$service_description = '{{cookiecutter.project_name}} FIXME Service',
$service_type = 'FIXME',
$region = 'RegionOne',
@ -69,18 +69,16 @@ class {{cookiecutter.project_name}}::keystone::auth (
$internal_url = 'http://127.0.0.1:FIXME',
) {
$real_service_name = pick($service_name, $auth_name)
if $configure_user_role {
Keystone_user_role["${auth_name}@${tenant}"] ~> Service <| name == '{{cookiecutter.project_name}}-server' |>
}
Keystone_endpoint["${region}/${real_service_name}::${service_type}"] ~> Service <| name == '{{cookiecutter.project_name}}-server' |>
Keystone_endpoint["${region}/${service_name}::${service_type}"] ~> Service <| name == '{{cookiecutter.project_name}}-server' |>
keystone::resource::service_identity { '{{cookiecutter.project_name}}':
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 => $service_description,
region => $region,

View File

@ -59,8 +59,8 @@ describe '{{cookiecutter.project_name}}::keystone::auth' do
it { is_expected.to contain_keystone_user('{{cookiecutter.project_name}}y') }
it { is_expected.to contain_keystone_user_role('{{cookiecutter.project_name}}y@services') }
it { is_expected.to contain_keystone_service('{{cookiecutter.project_name}}y::FIXME') }
it { is_expected.to contain_keystone_endpoint('RegionOne/{{cookiecutter.project_name}}y::FIXME') }
it { is_expected.to contain_keystone_service('{{cookiecutter.project_name}}::FIXME') }
it { is_expected.to contain_keystone_endpoint('RegionOne/{{cookiecutter.project_name}}::FIXME') }
end
context 'when overriding service name' do