From 3aba7229b2400f8495534684787dd7916d60677e Mon Sep 17 00:00:00 2001 From: Rico Lin Date: Mon, 23 Mar 2015 10:15:45 +0800 Subject: [PATCH] Adds ability to override service name for service catalog Instead of forcing the name of the service in the service catalog to match auth_name, this allows the ability to explicitly set the service name, spearately from auth_name. If service_name is not specified, it's value defaults to the value of auth_name (which maintains the current behavior.) Change-Id: Ibd44ddf46478a19f92c98e721a3fa04804d0d40d Closes-bug: #1359755 --- manifests/keystone/auth.pp | 10 +++++++++- spec/classes/designate_keystone_auth_spec.rb | 13 +++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/manifests/keystone/auth.pp b/manifests/keystone/auth.pp index ca2708ef..d8b9aa9f 100644 --- a/manifests/keystone/auth.pp +++ b/manifests/keystone/auth.pp @@ -16,6 +16,10 @@ # [*configure_endpoint*] # Should designate endpoint be configured? Optional. Defaults to 'true'. # +# [*service_name*] +# (optional) Name of the service. +# Defaults to the value of auth_name. +# # [*service_type*] # Type of service. Optional. Defaults to 'metering'. # @@ -53,6 +57,7 @@ class designate::keystone::auth ( $password = false, $email = 'designate@localhost', $auth_name = 'designate', + $service_name = undef, $service_type = 'dns', $public_address = '127.0.0.1', $admin_address = '127.0.0.1', @@ -67,17 +72,20 @@ class designate::keystone::auth ( $configure_endpoint = true ) { + $real_service_name = pick($service_name, $auth_name) Keystone_user_role["${auth_name}@${tenant}"] ~> Service <| name == 'designate-api' |> - keystone::resource::service_identity { $auth_name: + keystone::resource::service_identity { 'designate': configure_user => true, configure_user_role => true, configure_endpoint => $configure_endpoint, + service_name => $real_service_name, service_type => $service_type, service_description => 'Openstack DNSaas Service', region => $region, + auth_name => $auth_name, password => $password, email => $email, tenant => $tenant, diff --git a/spec/classes/designate_keystone_auth_spec.rb b/spec/classes/designate_keystone_auth_spec.rb index 94a7335f..2f194853 100644 --- a/spec/classes/designate_keystone_auth_spec.rb +++ b/spec/classes/designate_keystone_auth_spec.rb @@ -80,4 +80,17 @@ describe 'designate::keystone::auth' do it { is_expected.to contain_keystone_service('designate1') } it { is_expected.to contain_keystone_endpoint('RegionOne/designate1') } end + + describe 'when overriding service name' do + let :params do + { :service_name => 'designate_service', + :password => 'foo', + :auth_name => 'designate1' } + end + + it { is_expected.to contain_keystone_user('designate1') } + it { is_expected.to contain_keystone_user_role('designate1@services') } + it { is_expected.to contain_keystone_service('designate_service') } + it { is_expected.to contain_keystone_endpoint('RegionOne/designate_service') } + end end