Allow to not manage Keystone domain

When configuring Heat domains, we might want to use the default domain.
However, the default domain might already exist or managed by
puppet-keystone.
This patch allows to disable its management in puppet-heat, but keep
True for backward compatibility so the domain will be managed by
default.

Change-Id: I2e9f2ebb5b12cc33565d74bf955250dcc82bcbb9
This commit is contained in:
Emilien Macchi 2015-09-25 12:23:49 -04:00
parent b608fcebda
commit 320e93d301
2 changed files with 25 additions and 7 deletions

View File

@ -12,10 +12,16 @@
#
# [*domain_admin_email*]
# Keystone domain admin user email address. Defaults to 'heat_admin@localhost'.
#
# [*domain_password*]
# Keystone domain admin user password. Defaults to 'changeme'.
#
# [*manage_domain*]
# Whether manage or not the domain creation.
# If using the default domain, it needs to be False because puppet-keystone
# can already manage it.
# Defaults to 'true'.
#
# === Deprecated Parameters
#
# [*auth_url*]
@ -35,7 +41,7 @@ class heat::keystone::domain (
$domain_admin = 'heat_admin',
$domain_admin_email = 'heat_admin@localhost',
$domain_password = 'changeme',
$manage_domain = true,
# DEPRECATED PARAMETERS
$auth_url = undef,
$keystone_admin = undef,
@ -58,11 +64,13 @@ class heat::keystone::domain (
warning('The keystone_tenant parameter is deprecated and will be removed in future releases')
}
ensure_resource('keystone_domain', 'heat_domain', {
'ensure' => 'present',
'enabled' => true,
'name' => $domain_name
})
if $manage_domain {
ensure_resource('keystone_domain', 'heat_domain', {
'ensure' => 'present',
'enabled' => true,
'name' => $domain_name
})
}
ensure_resource('keystone_user', 'heat_domain_admin', {
'ensure' => 'present',
'enabled' => true,

View File

@ -37,6 +37,16 @@ describe 'heat::keystone::domain' do
:roles => ['admin'],
)
end
context 'when not managing the domain creation' do
before do
params.merge!(
:manage_domain => false
)
end
it { is_expected.to_not contain_keystone_domain('heat_domain') }
end
end