Create rating role in keystone/auth.pp

Change-Id: If01defed82ad48967e7fc9e6d6d7ae2a59507684
This commit is contained in:
William Huang
2017-10-13 23:30:31 +08:00
parent 0a53bd7a37
commit c6401c942d
2 changed files with 34 additions and 0 deletions

View File

@@ -52,6 +52,14 @@
# [*internal_url*]
# (optional) The endpoint's internal url. (Defaults to 'http://127.0.0.1:8889')
#
# [*manage_rating_role*]
# (optional) If true, this will manage the Keystone role for $rating_role.
# Defaults to 'true'.
#
# [*rating_role*]
# (optional) Keystone role for cloudkitty rating users.
# Defaults to 'rating'.
#
class cloudkitty::keystone::auth (
$password,
$auth_name = 'cloudkitty',
@@ -67,6 +75,8 @@ class cloudkitty::keystone::auth (
$public_url = 'http://127.0.0.1:8889',
$admin_url = 'http://127.0.0.1:8889',
$internal_url = 'http://127.0.0.1:8889',
$manage_rating_role = true,
$rating_role = 'rating',
) {
include ::cloudkitty::deps
@@ -93,4 +103,11 @@ class cloudkitty::keystone::auth (
admin_url => $admin_url,
}
if $manage_rating_role {
keystone_role { $rating_role:
ensure => present,
}
}
}

View File

@@ -33,6 +33,10 @@ describe 'cloudkitty::keystone::auth' do
:admin_url => 'http://127.0.0.1:8889',
:internal_url => 'http://127.0.0.1:8889',
) }
it { is_expected.to contain_keystone_role('rating').with(
:ensure => 'present',
) }
end
context 'when overriding URL parameters' do
@@ -112,6 +116,19 @@ describe 'cloudkitty::keystone::auth' do
) }
end
context 'when disabling rating role management' do
let :params do
{
:password => 'cloudkitty_password',
:manage_rating_role => false,
:rating_role => 'rating',
}
end
it { is_expected.not_to contain_keystone_role('rating') }
end
end
on_supported_os({