From 87c7e5d22f3628fc2e9fdbd0cecd5ca2b2ea07c5 Mon Sep 17 00:00:00 2001 From: Venkata Mahesh Jonnalagadda Date: Thu, 2 Jun 2016 06:32:50 -0400 Subject: [PATCH] Provide default service_name for keystone endpoint This change updates the mistral::keystone::auth class to include a default service_name of 'mistral' so that if a user changes the auth_name, the service is still created as being related to 'mistral'. This improves the user experiance when they want to customize the usernames for services. Closes-bug: #1590040 Change-Id: I94d5429a21acea5d9fe8812f85fb65cfeb3094a3 --- manifests/keystone/auth.pp | 15 +++++--------- .../keystone-auth-name-6717f5018361ef99.yaml | 5 +++++ spec/classes/mistral_keystone_auth_spec.rb | 20 ++++--------------- 3 files changed, 14 insertions(+), 26 deletions(-) create mode 100644 releasenotes/notes/keystone-auth-name-6717f5018361ef99.yaml diff --git a/manifests/keystone/auth.pp b/manifests/keystone/auth.pp index d16cd6a..1f08864 100644 --- a/manifests/keystone/auth.pp +++ b/manifests/keystone/auth.pp @@ -43,7 +43,7 @@ # # [*service_name*] # (optional) Name of the service. -# Defaults to the value of auth_name. +# Defaults to 'mistral'. # # [*configure_service*] # Should mistral service be configured? Defaults to 'true'. @@ -60,7 +60,7 @@ class mistral::keystone::auth( $password, $email = 'mistral@localhost', $auth_name = 'mistral', - $service_name = undef, + $service_name = 'mistral', $service_type = 'workflowv2', $public_url = 'http://127.0.0.1:8989/v2', $admin_url = 'http://127.0.0.1:8989/v2', @@ -76,20 +76,15 @@ class mistral::keystone::auth( validate_string($password) - if $service_name == undef { - $real_service_name = $auth_name - } else { - $real_service_name = $service_name - } - - keystone::resource::service_identity { $auth_name: + keystone::resource::service_identity { 'mistral': 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, region => $region, + auth_name => $auth_name, password => $password, email => $email, tenant => $tenant, diff --git a/releasenotes/notes/keystone-auth-name-6717f5018361ef99.yaml b/releasenotes/notes/keystone-auth-name-6717f5018361ef99.yaml new file mode 100644 index 0000000..835c883 --- /dev/null +++ b/releasenotes/notes/keystone-auth-name-6717f5018361ef99.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/mistral_keystone_auth_spec.rb b/spec/classes/mistral_keystone_auth_spec.rb index 7a5763f..c936e33 100644 --- a/spec/classes/mistral_keystone_auth_spec.rb +++ b/spec/classes/mistral_keystone_auth_spec.rb @@ -39,10 +39,11 @@ describe 'mistral::keystone::auth' do ) } end - describe 'when overriding auth name' do + describe 'when overriding auth and service name' do let :params do - { :password => 'foo', - :auth_name => 'mistraly' } + { :service_name => 'mistraly', + :auth_name => 'mistraly', + :password => 'mistral_password' } end it { is_expected.to contain_keystone_user('mistraly') } @@ -51,19 +52,6 @@ describe 'mistral::keystone::auth' do it { is_expected.to contain_keystone_endpoint('RegionOne/mistraly::workflowv2') } end - describe 'when overriding service name' do - let :params do - { :service_name => 'mistral_service', - :auth_name => 'mistral', - :password => 'mistral_password' } - end - - it { is_expected.to contain_keystone_user('mistral') } - it { is_expected.to contain_keystone_user_role('mistral@services') } - it { is_expected.to contain_keystone_service('mistral_service::workflowv2') } - it { is_expected.to contain_keystone_endpoint('RegionOne/mistral_service::workflowv2') } - end - describe 'when disabling user configuration' do let :params do