Provide default service_name for keystone endpoint

This change updates the neutron::keystone::auth class to include a
default service_name of 'neutron' so that if a user changes the
auth_name, the service is still created as being related to
'neutron'.

Closes-bug: #1590040
Change-Id: I3b23ad48a2b080ee32b333b81dcfe7f2369ee2e4
This commit is contained in:
Juan Antonio Osorio Robles 2016-06-08 09:01:08 +03:00 committed by Iury Gregory Melo Ferreira
parent cd1f0d98cc
commit cd863e67c1
3 changed files with 13 additions and 9 deletions

View File

@ -27,7 +27,7 @@
# Defaults to 'true'.
#
# [*service_name*]
# Name of the service. Defaults to the value of auth_name.
# Name of the service. Defaults 'neutron'.
#
# [*service_type*]
# Type of service. Defaults to 'network'.
@ -68,7 +68,7 @@ class neutron::keystone::auth (
$configure_endpoint = true,
$configure_user = true,
$configure_user_role = true,
$service_name = undef,
$service_name = 'neutron',
$service_type = 'network',
$service_description = 'Neutron Networking Service',
$region = 'RegionOne',
@ -77,23 +77,22 @@ class neutron::keystone::auth (
$internal_url = 'http://127.0.0.1:9696',
) {
$real_service_name = pick($service_name, $auth_name)
if $configure_endpoint {
Keystone_endpoint["${region}/${real_service_name}::${service_type}"] ~> Service <| title == 'neutron-server' |>
Keystone_endpoint["${region}/${service_name}::${service_type}"] ~> Service <| title == 'neutron-server' |>
}
if $configure_user_role {
Keystone_user_role["${auth_name}@${tenant}"] ~> Service <| title == 'neutron-server' |>
}
keystone::resource::service_identity { $auth_name:
keystone::resource::service_identity { 'neutron':
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,
auth_name => $auth_name,
region => $region,
password => $password,
email => $email,

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

@ -92,9 +92,9 @@ describe 'neutron::keystone::auth' do
it { is_expected.to contain_keystone_user_role('neutrony@services') }
it { is_expected.to contain_keystone_service('neutrony::network') }
it { is_expected.to contain_keystone_service('neutron::network') }
it { is_expected.to contain_keystone_endpoint('RegionOne/neutrony::network') }
it { is_expected.to contain_keystone_endpoint('RegionOne/neutron::network') }
end