Improve heat::keystone::domain
- change resource names so that autorequire works - enable to skip Keystone resource management Change-Id: I9078be31f26e454e0686debcefa070721767a581
This commit is contained in:
parent
aede7c5c91
commit
e7c472d053
@ -22,6 +22,14 @@
|
|||||||
# can already manage it.
|
# can already manage it.
|
||||||
# Defaults to 'true'.
|
# Defaults to 'true'.
|
||||||
#
|
#
|
||||||
|
# [*manage_user*]
|
||||||
|
# Whether manage or not the user creation.
|
||||||
|
# Defaults to 'true'.
|
||||||
|
#
|
||||||
|
# [*manage_role*]
|
||||||
|
# Whether manage or not the user role creation.
|
||||||
|
# Defaults to 'true'.
|
||||||
|
#
|
||||||
# === Deprecated Parameters
|
# === Deprecated Parameters
|
||||||
#
|
#
|
||||||
# [*auth_url*]
|
# [*auth_url*]
|
||||||
@ -42,6 +50,8 @@ class heat::keystone::domain (
|
|||||||
$domain_admin_email = 'heat_admin@localhost',
|
$domain_admin_email = 'heat_admin@localhost',
|
||||||
$domain_password = 'changeme',
|
$domain_password = 'changeme',
|
||||||
$manage_domain = true,
|
$manage_domain = true,
|
||||||
|
$manage_user = true,
|
||||||
|
$manage_role = true,
|
||||||
# DEPRECATED PARAMETERS
|
# DEPRECATED PARAMETERS
|
||||||
$auth_url = undef,
|
$auth_url = undef,
|
||||||
$keystone_admin = undef,
|
$keystone_admin = undef,
|
||||||
@ -66,23 +76,24 @@ class heat::keystone::domain (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if $manage_domain {
|
if $manage_domain {
|
||||||
ensure_resource('keystone_domain', 'heat_domain', {
|
ensure_resource('keystone_domain', $domain_name, {
|
||||||
'ensure' => 'present',
|
'ensure' => 'present',
|
||||||
'enabled' => true,
|
'enabled' => true,
|
||||||
'name' => $domain_name
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
ensure_resource('keystone_user', 'heat_domain_admin', {
|
if $manage_user {
|
||||||
'ensure' => 'present',
|
ensure_resource('keystone_user', "${domain_admin}::${domain_name}", {
|
||||||
'enabled' => true,
|
'ensure' => 'present',
|
||||||
'name' => $domain_admin,
|
'enabled' => true,
|
||||||
'email' => $domain_admin_email,
|
'email' => $domain_admin_email,
|
||||||
'password' => $domain_password,
|
'password' => $domain_password,
|
||||||
'domain' => $domain_name,
|
})
|
||||||
})
|
}
|
||||||
ensure_resource('keystone_user_role', "${domain_admin}::${domain_name}@::${domain_name}", {
|
if $manage_role {
|
||||||
'roles' => ['admin'],
|
ensure_resource('keystone_user_role', "${domain_admin}::${domain_name}@::${domain_name}", {
|
||||||
})
|
'roles' => ['admin'],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
heat_config {
|
heat_config {
|
||||||
'DEFAULT/stack_domain_admin': value => $domain_admin;
|
'DEFAULT/stack_domain_admin': value => $domain_admin;
|
||||||
|
@ -19,21 +19,19 @@ describe 'heat::keystone::domain' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'should create keystone domain' do
|
it 'should create keystone domain' do
|
||||||
is_expected.to contain_keystone_domain('heat_domain').with(
|
is_expected.to contain_keystone_domain(params[:domain_name]).with(
|
||||||
:ensure => 'present',
|
:ensure => 'present',
|
||||||
:enabled => 'true',
|
:enabled => 'true',
|
||||||
:name => params[:domain_name]
|
:name => params[:domain_name]
|
||||||
)
|
)
|
||||||
|
|
||||||
is_expected.to contain_keystone_user('heat_domain_admin').with(
|
is_expected.to contain_keystone_user("#{params[:domain_admin]}::#{params[:domain_name]}").with(
|
||||||
:ensure => 'present',
|
:ensure => 'present',
|
||||||
:enabled => 'true',
|
:enabled => 'true',
|
||||||
:name => params[:domain_admin],
|
|
||||||
:email => params[:domain_admin_email],
|
:email => params[:domain_admin_email],
|
||||||
:password => params[:domain_password],
|
:password => params[:domain_password],
|
||||||
:domain => params[:domain_name],
|
|
||||||
)
|
)
|
||||||
is_expected.to contain_keystone_user_role('heat_admin::heat@::heat').with(
|
is_expected.to contain_keystone_user_role("#{params[:domain_admin]}::#{params[:domain_name]}@::#{params[:domain_name]}").with(
|
||||||
:roles => ['admin'],
|
:roles => ['admin'],
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
@ -47,6 +45,26 @@ describe 'heat::keystone::domain' do
|
|||||||
|
|
||||||
it { is_expected.to_not contain_keystone_domain('heat_domain') }
|
it { is_expected.to_not contain_keystone_domain('heat_domain') }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when not managing the user creation' do
|
||||||
|
before do
|
||||||
|
params.merge!(
|
||||||
|
:manage_user => false
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
it { is_expected.to_not contain_keystone_user("#{params[:domain_admin]}::#{params[:domain_name]}") }
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when not managing the user role creation' do
|
||||||
|
before do
|
||||||
|
params.merge!(
|
||||||
|
:manage_role => false
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
it { is_expected.to_not contain_keystone_user_role("#{params[:domain_admin]}::#{params[:domain_name]}@::#{params[:domain_name]}") }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user