Use a 'params' hash for authtoken parameters
This change adds the 'params' hash in authtoken class, to implement the same functionality as the one recently introduced into puppet-nova[1]. [1] 5c38281e1b698f157f03bf1815733277c541c30b Change-Id: Ic4f451cfbd0145466ae65330729e980f5567795e
This commit is contained in:
parent
ef245de870
commit
658788fd87
|
@ -187,6 +187,10 @@
|
|||
# "public", "internal" or "admin".
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*params*]
|
||||
# (Optional) Hash of additional parameters to pass through to the keystone
|
||||
# authtoken class. Values set here override the individual parameters above.
|
||||
#
|
||||
class glance::api::authtoken(
|
||||
$username = 'glance',
|
||||
$password = $::os_service_default,
|
||||
|
@ -224,6 +228,7 @@ class glance::api::authtoken(
|
|||
$service_token_roles_required = $::os_service_default,
|
||||
$service_type = $::os_service_default,
|
||||
$interface = $::os_service_default,
|
||||
$params = {}
|
||||
) {
|
||||
|
||||
include glance::deps
|
||||
|
@ -232,7 +237,10 @@ class glance::api::authtoken(
|
|||
fail('Please set password for Glance service user')
|
||||
}
|
||||
|
||||
keystone::resource::authtoken { 'glance_api_config':
|
||||
keystone::resource::authtoken {
|
||||
'glance_api_config':
|
||||
* => $params;
|
||||
default:
|
||||
username => $username,
|
||||
password => $password,
|
||||
project_name => $project_name,
|
||||
|
@ -268,6 +276,6 @@ class glance::api::authtoken(
|
|||
service_token_roles => $service_token_roles,
|
||||
service_token_roles_required => $service_token_roles_required,
|
||||
service_type => $service_type,
|
||||
interface => $interface,
|
||||
interface => $interface;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -132,7 +132,18 @@ describe 'glance::api::authtoken' do
|
|||
it 'installs python memcache package' do
|
||||
is_expected.to contain_package('python-memcache')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when overriding parameters via params hash' do
|
||||
before do
|
||||
params.merge!({
|
||||
:username => 'myuser',
|
||||
:params => { 'username' => 'myotheruser' },
|
||||
})
|
||||
end
|
||||
it 'configure keystone_authtoken' do
|
||||
is_expected.to contain_glance_api_config('keystone_authtoken/username').with_value(params[:params]['username'])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue