Add purge_config option

Add the option in order to facilitate management.
User can ensure that only the options they hoped
are configured.

Change-Id: I4799d56657639bbeb1baca82db42bc4235347349
This commit is contained in:
ZhongShengping 2016-06-08 11:00:41 +08:00
parent 8ee1343198
commit 808a0e7d09
2 changed files with 19 additions and 0 deletions

View File

@ -63,6 +63,11 @@
# on some distributions.
# Defaults to $::os_service_default
#
# [*purge_config*]
# (optional) Whether to set only the specified config options
# in the magnum config.
# Defaults to false.
#
class magnum(
$package_ensure = 'present',
$notification_driver = $::os_service_default,
@ -78,6 +83,7 @@ class magnum(
$kombu_ssl_certfile = $::os_service_default,
$kombu_ssl_keyfile = $::os_service_default,
$kombu_ssl_version = $::os_service_default,
$purge_config = false,
) {
include ::magnum::params
@ -91,6 +97,10 @@ class magnum(
tag => ['openstack', 'magnum-package'],
}
resources { 'magnum_config':
purge => $purge_config,
}
if $rpc_backend == 'rabbit' {
if ! $rabbit_password {

View File

@ -5,6 +5,9 @@ describe 'magnum' do
shared_examples 'magnum' do
context 'with default parameters' do
let :params do
{ :purge_config => false }
end
it 'contains other classes' do
is_expected.to contain_class('magnum::logging')
@ -27,6 +30,12 @@ describe 'magnum' do
)
end
it 'passes purge to resource' do
is_expected.to contain_resources('magnum_config').with({
:purge => false
})
end
it 'configures rabbit' do
is_expected.to contain_magnum_config('DEFAULT/rpc_backend').with_value('rabbit')
is_expected.to contain_magnum_config('oslo_messaging_rabbit/rabbit_host').with_value('<SERVICE_DEFAULT>')