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
This commit is contained in:
Dan Prince 2016-02-11 13:37:49 -05:00
parent 1fba97d779
commit 5a0b65b1ea
2 changed files with 65 additions and 58 deletions

View File

@ -23,24 +23,20 @@
# (Optional) Should the service user be configured? # (Optional) Should the service user be configured?
# Defaults to 'true'. # Defaults to 'true'.
# #
# [*configure_user_role*]
# (Optional) Should the admin role be configured for the service user?
# Defaults to 'true'.
#
# [*service_type*] # [*service_type*]
# Type of service. Defaults to 'queue'. # Type of service. Defaults to 'messaging'.
#
# [*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 '/'.
# #
# [*public_url*] # [*public_url*]
# (optional) The endpoint's public url. (Defaults to 'http://127.0.0.1:8888') # (optional) The endpoint's public url.
# This url should *not* contain any version or trailing '/'. # (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*]
# Region for endpoint. Defaults to 'RegionOne'. # Region for endpoint. Defaults to 'RegionOne'.
@ -49,45 +45,56 @@
# (optional) Name of the service. # (optional) Name of the service.
# Defaults to the value of auth_name. # 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, $password,
$auth_name = 'zaqar', $email = 'zaqar@localhost',
$email = 'zaqar@localhost', $auth_name = 'zaqar',
$tenant = 'services', $service_name = undef,
$configure_endpoint = true, $service_type = 'messaging',
$configure_user = true, $public_url = 'http://127.0.0.1:8888',
$configure_user_role = true, $admin_url = 'http://127.0.0.1:8888',
$service_name = undef, $internal_url = 'http://127.0.0.1:8888',
$service_type = 'queue', $region = 'RegionOne',
$admin_url = 'http://127.0.0.1:8888', $tenant = 'services',
$internal_url = 'http://127.0.0.1:8888', $configure_endpoint = true,
$public_url = 'http://127.0.0.1:8888', $configure_service = true,
$region = 'RegionOne' $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 { if $service_name == undef {
Keystone_user_role["${auth_name}@${tenant}"] ~> Service <| name == 'zaqar-server' |> $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 => $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_type => $service_type, service_type => $service_type,
service_description => 'zaqar queue service', service_description => $service_description,
service_name => $real_service_name,
region => $region, region => $region,
auth_name => $auth_name,
password => $password, password => $password,
email => $email, email => $email,
tenant => $tenant, tenant => $tenant,
admin_url => "${admin_url}/", public_url => $public_url,
internal_url => "${internal_url}/", admin_url => $admin_url,
public_url => "${public_url}/", internal_url => $internal_url,
} }
} }

View File

@ -26,16 +26,16 @@ describe 'zaqar::keystone::auth' do
:roles => ['admin'] :roles => ['admin']
)} )}
it { is_expected.to contain_keystone_service('zaqar::queue').with( it { is_expected.to contain_keystone_service('zaqar::messaging').with(
:ensure => 'present', :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', :ensure => 'present',
:public_url => "http://127.0.0.1:8888/", :public_url => "http://127.0.0.1:8888",
:admin_url => "http://127.0.0.1:8888/", :admin_url => "http://127.0.0.1:8888",
:internal_url => "http://127.0.0.1:8888/" :internal_url => "http://127.0.0.1:8888"
) } ) }
end end
@ -48,11 +48,11 @@ describe 'zaqar::keystone::auth' do
} }
end 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', :ensure => 'present',
:public_url => "https://10.10.10.10:8080/", :public_url => "https://10.10.10.10:8080",
:internal_url => "http://10.10.10.10:8080/", :internal_url => "http://10.10.10.10:8080",
:admin_url => "http://10.10.10.10:8080/" :admin_url => "http://10.10.10.10:8080"
) } ) }
end 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('zaqary') }
it { is_expected.to contain_keystone_user_role('zaqary@services') } 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_service('zaqary::messaging') }
it { is_expected.to contain_keystone_endpoint('RegionOne/zaqary::queue') } it { is_expected.to contain_keystone_endpoint('RegionOne/zaqary::messaging') }
end end
describe 'when overriding service name' do 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('zaqar') }
it { is_expected.to contain_keystone_user_role('zaqar@services') } 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_service('zaqar_service::messaging') }
it { is_expected.to contain_keystone_endpoint('RegionOne/zaqar_service::queue') } it { is_expected.to contain_keystone_endpoint('RegionOne/zaqar_service::messaging') }
end end
describe 'when disabling user configuration' do 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.not_to contain_keystone_user('zaqar') }
it { is_expected.to contain_keystone_user_role('zaqar@services') } 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', :ensure => 'present',
:description => 'zaqar queue service' :description => 'Openstack messaging Service'
) } ) }
end 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('zaqar') }
it { is_expected.not_to contain_keystone_user_role('zaqar@services') } 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', :ensure => 'present',
:description => 'zaqar queue service' :description => 'Openstack messaging Service'
) } ) }
end end