diff --git a/manifests/keystone/auth.pp b/manifests/keystone/auth.pp index 8f193b1b..b5a9e11e 100644 --- a/manifests/keystone/auth.pp +++ b/manifests/keystone/auth.pp @@ -32,7 +32,7 @@ # # [*service_name*] # (Optional) Name of the service. -# Defaults to the value of auth_name. +# Defaults to 'heat'. # # [*service_type*] # (Optional) Type of service. @@ -97,7 +97,7 @@ class heat::keystone::auth ( $password = false, $email = 'heat@localhost', $auth_name = 'heat', - $service_name = undef, + $service_name = 'heat', $service_type = 'orchestration', $service_description = 'Openstack Orchestration Service', $region = 'RegionOne', @@ -119,17 +119,16 @@ class heat::keystone::auth ( validate_string($password) - $real_service_name = pick($service_name, $auth_name) - - keystone::resource::service_identity { $auth_name: + keystone::resource::service_identity { 'heat': configure_user => $configure_user, configure_user_role => $configure_user_role, configure_endpoint => $configure_endpoint, configure_service => $configure_service, service_type => $service_type, service_description => $service_description, - service_name => $real_service_name, + service_name => $service_name, region => $region, + auth_name => $auth_name, password => $password, email => $email, tenant => $tenant, diff --git a/manifests/keystone/auth_cfn.pp b/manifests/keystone/auth_cfn.pp index e499a448..19cdee20 100644 --- a/manifests/keystone/auth_cfn.pp +++ b/manifests/keystone/auth_cfn.pp @@ -32,7 +32,7 @@ # # [*service_name*] # (Optional) Name of the service. -# Defaults to the value of auth_name. +# Defaults to 'heat'. # # [*service_type*] # (Optional) Type of service. @@ -70,7 +70,7 @@ class heat::keystone::auth_cfn ( $password = false, $email = 'heat-cfn@localhost', $auth_name = 'heat-cfn', - $service_name = undef, + $service_name = 'heat-cfn', $service_type = 'cloudformation', $region = 'RegionOne', $tenant = 'services', @@ -87,17 +87,16 @@ class heat::keystone::auth_cfn ( validate_string($password) - $real_service_name = pick($service_name, $auth_name) - - keystone::resource::service_identity { $auth_name: + keystone::resource::service_identity { 'heat-cfn': configure_user => $configure_user, configure_user_role => $configure_user_role, configure_endpoint => $configure_endpoint, configure_service => $configure_service, service_type => $service_type, service_description => 'Openstack Cloudformation Service', - service_name => $real_service_name, + service_name => $service_name, region => $region, + auth_name => $auth_name, password => $password, email => $email, tenant => $tenant, diff --git a/releasenotes/notes/keystone-auth-name-8b4dba1dfc52533b.yaml b/releasenotes/notes/keystone-auth-name-8b4dba1dfc52533b.yaml new file mode 100644 index 00000000..835c883b --- /dev/null +++ b/releasenotes/notes/keystone-auth-name-8b4dba1dfc52533b.yaml @@ -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. diff --git a/spec/classes/heat_keystone_auth_cfn_spec.rb b/spec/classes/heat_keystone_auth_cfn_spec.rb index 866d6c32..16f9faad 100644 --- a/spec/classes/heat_keystone_auth_cfn_spec.rb +++ b/spec/classes/heat_keystone_auth_cfn_spec.rb @@ -70,23 +70,24 @@ describe 'heat::keystone::auth_cfn' do end end - context 'when overriding service name' do + context 'when overriding auth and service name' do before do params.merge!({ - :service_name => 'heat-cfn_service' + :auth_name => 'heat-cfny', + :service_name => 'heat-cfny' }) end it 'configures correct user name' do - is_expected.to contain_keystone_user('heat-cfn') + is_expected.to contain_keystone_user('heat-cfny') end it 'configures correct user role' do - is_expected.to contain_keystone_user_role('heat-cfn@services') + is_expected.to contain_keystone_user_role('heat-cfny@services') end it 'configures correct service name' do - is_expected.to contain_keystone_service('heat-cfn_service::cloudformation') + is_expected.to contain_keystone_service('heat-cfny::cloudformation') end it 'configures correct endpoint name' do - is_expected.to contain_keystone_endpoint('RegionOne/heat-cfn_service::cloudformation') + is_expected.to contain_keystone_endpoint('RegionOne/heat-cfny::cloudformation') end end diff --git a/spec/classes/heat_keystone_auth_spec.rb b/spec/classes/heat_keystone_auth_spec.rb index bfd0fa79..a88b11c5 100644 --- a/spec/classes/heat_keystone_auth_spec.rb +++ b/spec/classes/heat_keystone_auth_spec.rb @@ -77,23 +77,24 @@ describe 'heat::keystone::auth' do end end - context 'when overriding service name' do + context 'when overriding auth and service name' do before do params.merge!({ - :service_name => 'heat_service' + :auth_name => 'heaty', + :service_name => 'heaty' }) end it 'configures correct user name' do - is_expected.to contain_keystone_user('heat') + is_expected.to contain_keystone_user('heaty') end it 'configures correct user role' do - is_expected.to contain_keystone_user_role('heat@services') + is_expected.to contain_keystone_user_role('heaty@services') end it 'configures correct service name' do - is_expected.to contain_keystone_service('heat_service::orchestration') + is_expected.to contain_keystone_service('heaty::orchestration') end it 'configures correct endpoint name' do - is_expected.to contain_keystone_endpoint('RegionOne/heat_service::orchestration') + is_expected.to contain_keystone_endpoint('RegionOne/heaty::orchestration') end end