Change default service_name to 'ironic'

While we were already able to pick an independent auth_name and
service_name; the service_name was defaulting to auth_name. Now it
has a value of its own to be consistent with other modules.

Change-Id: I6fee7965ec51928df9a81cacbcf60aebadb7becf
Related-Bug: #1590040
This commit is contained in:
Marcellin Fom Tchassem
2016-06-07 18:06:50 -05:00
parent 31fae45a7b
commit f21260370f
3 changed files with 13 additions and 9 deletions

View File

@@ -46,7 +46,7 @@
# #
# [*service_name*] # [*service_name*]
# (Optional) Name of the service. # (Optional) Name of the service.
# Defaults to the value of auth_name, but must differ from the value. # Defaults to the value of 'ironic'.
# #
# [*service_type*] # [*service_type*]
# Type of service. Defaults to 'baremetal'. # Type of service. Defaults to 'baremetal'.
@@ -86,7 +86,7 @@ class ironic::keystone::auth (
$configure_endpoint = true, $configure_endpoint = true,
$configure_user = true, $configure_user = true,
$configure_user_role = true, $configure_user_role = true,
$service_name = undef, $service_name = 'ironic',
$service_type = 'baremetal', $service_type = 'baremetal',
$service_description = 'Ironic Bare Metal Provisioning Service', $service_description = 'Ironic Bare Metal Provisioning Service',
$region = 'RegionOne', $region = 'RegionOne',
@@ -95,20 +95,19 @@ class ironic::keystone::auth (
$internal_url = 'http://127.0.0.1:6385', $internal_url = 'http://127.0.0.1:6385',
) { ) {
$real_service_name = pick($service_name, $auth_name)
if $configure_user_role { if $configure_user_role {
Keystone_user_role["${auth_name}@${tenant}"] ~> Service <| name == 'ironic-server' |> Keystone_user_role["${auth_name}@${tenant}"] ~> Service <| name == 'ironic-server' |>
} }
Keystone_endpoint["${region}/${real_service_name}::${service_type}"] ~> Service <| name == 'ironic-server' |> Keystone_endpoint["${region}/${service_name}::${service_type}"] ~> Service <| name == 'ironic-server' |>
keystone::resource::service_identity { $auth_name: keystone::resource::service_identity { 'ironic':
configure_user => $configure_user, configure_user => $configure_user,
configure_user_role => $configure_user_role, configure_user_role => $configure_user_role,
configure_endpoint => $configure_endpoint, configure_endpoint => $configure_endpoint,
service_name => $real_service_name, service_name => $service_name,
service_type => $service_type, service_type => $service_type,
auth_name => $auth_name,
service_description => $service_description, service_description => $service_description,
region => $region, region => $region,
password => $password, 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

@@ -92,8 +92,8 @@ describe 'ironic::keystone::auth' do
it { is_expected.to contain_keystone_user('ironicy') } it { is_expected.to contain_keystone_user('ironicy') }
it { is_expected.to contain_keystone_user_role('ironicy@services') } it { is_expected.to contain_keystone_user_role('ironicy@services') }
it { is_expected.to contain_keystone_service('ironicy::baremetal') } it { is_expected.to contain_keystone_service('ironic::baremetal') }
it { is_expected.to contain_keystone_endpoint('RegionOne/ironicy::baremetal') } it { is_expected.to contain_keystone_endpoint('RegionOne/ironic::baremetal') }
end end
describe 'when overriding service name' do describe 'when overriding service name' do