From 5a0b65b1ea46ba0eeb3bb18d4e59086738e3274b Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Thu, 11 Feb 2016 13:37:49 -0500 Subject: [PATCH] Updated defaults for zaqar::keystone::auth Update the defaults for keystone::auth so that they are consistent with the project (python-zaqarclient, etc.) Change-Id: I317fb47a1326eb577dd0fa8ec5eb2d7ac842c4af --- manifests/keystone/auth.pp | 87 +++++++++++++----------- spec/classes/zaqar_keystone_auth_spec.rb | 36 +++++----- 2 files changed, 65 insertions(+), 58 deletions(-) diff --git a/manifests/keystone/auth.pp b/manifests/keystone/auth.pp index 8ef1d83..6c00afe 100644 --- a/manifests/keystone/auth.pp +++ b/manifests/keystone/auth.pp @@ -23,24 +23,20 @@ # (Optional) Should the service user be configured? # Defaults to 'true'. # -# [*configure_user_role*] -# (Optional) Should the admin role be configured for the service user? -# Defaults to 'true'. -# # [*service_type*] -# Type of service. Defaults to 'queue'. -# -# [*admin_url*] -# (optional) The endpoint's admin url. (Defaults to 'http://127.0.0.1:8888') -# This url should *not* contain any version or trailing '/'. -# -# [*internal_url*] -# (optional) The endpoint's internal url. (Defaults to 'http://127.0.0.1:8888') -# This url should *not* contain any version or trailing '/'. +# Type of service. Defaults to 'messaging'. # # [*public_url*] -# (optional) The endpoint's public url. (Defaults to 'http://127.0.0.1:8888') -# This url should *not* contain any version or trailing '/'. +# (optional) The endpoint's public url. +# (Defaults to 'http://127.0.0.1:8888') +# +# [*internal_url*] +# (optional) The endpoint's internal url. +# (Defaults to 'http://127.0.0.1:8888') +# +# [*admin_url*] +# (optional) The endpoint's admin url. +# (Defaults to 'http://127.0.0.1:8888') # # [*region*] # Region for endpoint. Defaults to 'RegionOne'. @@ -49,45 +45,56 @@ # (optional) Name of the service. # Defaults to the value of auth_name. # +# [*configure_service*] +# Should zaqar service be configured? Defaults to 'true'. # -class zaqar::keystone::auth ( +# [*service_description*] +# (optional) Description for keystone service. +# Defaults to 'Openstack workflow Service'. + +# [*configure_user_role*] +# (optional) Whether to configure the admin role for the service user. +# Defaults to true +# +class zaqar::keystone::auth( $password, - $auth_name = 'zaqar', - $email = 'zaqar@localhost', - $tenant = 'services', - $configure_endpoint = true, - $configure_user = true, - $configure_user_role = true, - $service_name = undef, - $service_type = 'queue', - $admin_url = 'http://127.0.0.1:8888', - $internal_url = 'http://127.0.0.1:8888', - $public_url = 'http://127.0.0.1:8888', - $region = 'RegionOne' + $email = 'zaqar@localhost', + $auth_name = 'zaqar', + $service_name = undef, + $service_type = 'messaging', + $public_url = 'http://127.0.0.1:8888', + $admin_url = 'http://127.0.0.1:8888', + $internal_url = 'http://127.0.0.1:8888', + $region = 'RegionOne', + $tenant = 'services', + $configure_endpoint = true, + $configure_service = true, + $configure_user = true, + $configure_user_role = true, + $service_description = 'Openstack messaging Service', ) { - $real_service_name = pick($service_name, $auth_name) + validate_string($password) - if $configure_user_role { - Keystone_user_role["${auth_name}@${tenant}"] ~> Service <| name == 'zaqar-server' |> + if $service_name == undef { + $real_service_name = $auth_name + } else { + $real_service_name = $service_name } - Keystone_endpoint["${region}/${real_service_name}::${service_type}"] ~> Service <| name == 'zaqar-server' |> - keystone::resource::service_identity { 'zaqar': + keystone::resource::service_identity { $auth_name: configure_user => $configure_user, configure_user_role => $configure_user_role, configure_endpoint => $configure_endpoint, - service_name => $real_service_name, service_type => $service_type, - service_description => 'zaqar queue service', + service_description => $service_description, + service_name => $real_service_name, region => $region, - auth_name => $auth_name, password => $password, email => $email, tenant => $tenant, - admin_url => "${admin_url}/", - internal_url => "${internal_url}/", - public_url => "${public_url}/", + public_url => $public_url, + admin_url => $admin_url, + internal_url => $internal_url, } - } diff --git a/spec/classes/zaqar_keystone_auth_spec.rb b/spec/classes/zaqar_keystone_auth_spec.rb index 03397d4..18114b8 100644 --- a/spec/classes/zaqar_keystone_auth_spec.rb +++ b/spec/classes/zaqar_keystone_auth_spec.rb @@ -26,16 +26,16 @@ describe 'zaqar::keystone::auth' do :roles => ['admin'] )} - it { is_expected.to contain_keystone_service('zaqar::queue').with( + it { is_expected.to contain_keystone_service('zaqar::messaging').with( :ensure => 'present', - :description => 'zaqar queue service' + :description => 'Openstack messaging Service' ) } - it { is_expected.to contain_keystone_endpoint('RegionOne/zaqar::queue').with( + it { is_expected.to contain_keystone_endpoint('RegionOne/zaqar::messaging').with( :ensure => 'present', - :public_url => "http://127.0.0.1:8888/", - :admin_url => "http://127.0.0.1:8888/", - :internal_url => "http://127.0.0.1:8888/" + :public_url => "http://127.0.0.1:8888", + :admin_url => "http://127.0.0.1:8888", + :internal_url => "http://127.0.0.1:8888" ) } end @@ -48,11 +48,11 @@ describe 'zaqar::keystone::auth' do } end - it { is_expected.to contain_keystone_endpoint('RegionOne/zaqar::queue').with( + it { is_expected.to contain_keystone_endpoint('RegionOne/zaqar::messaging').with( :ensure => 'present', - :public_url => "https://10.10.10.10:8080/", - :internal_url => "http://10.10.10.10:8080/", - :admin_url => "http://10.10.10.10:8080/" + :public_url => "https://10.10.10.10:8080", + :internal_url => "http://10.10.10.10:8080", + :admin_url => "http://10.10.10.10:8080" ) } end @@ -64,8 +64,8 @@ describe 'zaqar::keystone::auth' do it { is_expected.to contain_keystone_user('zaqary') } it { is_expected.to contain_keystone_user_role('zaqary@services') } - it { is_expected.to contain_keystone_service('zaqary::queue') } - it { is_expected.to contain_keystone_endpoint('RegionOne/zaqary::queue') } + it { is_expected.to contain_keystone_service('zaqary::messaging') } + it { is_expected.to contain_keystone_endpoint('RegionOne/zaqary::messaging') } end describe 'when overriding service name' do @@ -77,8 +77,8 @@ describe 'zaqar::keystone::auth' do it { is_expected.to contain_keystone_user('zaqar') } it { is_expected.to contain_keystone_user_role('zaqar@services') } - it { is_expected.to contain_keystone_service('zaqar_service::queue') } - it { is_expected.to contain_keystone_endpoint('RegionOne/zaqar_service::queue') } + it { is_expected.to contain_keystone_service('zaqar_service::messaging') } + it { is_expected.to contain_keystone_endpoint('RegionOne/zaqar_service::messaging') } end describe 'when disabling user configuration' do @@ -92,9 +92,9 @@ describe 'zaqar::keystone::auth' do it { is_expected.not_to contain_keystone_user('zaqar') } it { is_expected.to contain_keystone_user_role('zaqar@services') } - it { is_expected.to contain_keystone_service('zaqar::queue').with( + it { is_expected.to contain_keystone_service('zaqar::messaging').with( :ensure => 'present', - :description => 'zaqar queue service' + :description => 'Openstack messaging Service' ) } end @@ -111,9 +111,9 @@ describe 'zaqar::keystone::auth' do it { is_expected.not_to contain_keystone_user('zaqar') } it { is_expected.not_to contain_keystone_user_role('zaqar@services') } - it { is_expected.to contain_keystone_service('zaqar::queue').with( + it { is_expected.to contain_keystone_service('zaqar::messaging').with( :ensure => 'present', - :description => 'zaqar queue service' + :description => 'Openstack messaging Service' ) } end