Add enabled_notification_handlers option

This patch is aim to add enabled_notification_handlers option in
designate::sink, which is the only option exist in sink service.

Change-Id: Idb724f7564ff55c80964b5c2beae26f77e1e3bad
Close-Bug: #1486305
This commit is contained in:
Xingchao Yu 2015-08-19 12:14:49 +08:00
parent 6ba8165003
commit 84db12e9d8
2 changed files with 31 additions and 6 deletions

View File

@ -13,18 +13,25 @@
# Defaults to sink_package_name from designate::params
#
# [*enabled*]
# (optional) Whether to enable services.
# Defaults to true
# (optional) Whether to enable services.
# Defaults to true
#
# [*service_ensure*]
# (optional) Whether the designate sink service will be running.
# Defaults to 'running'
#
# [*enabled_notification_handlers*]
# (optional) List of notification handlers to enable, configuration of
# these needs to correspond to a [handler:my_driver] section below or
# else in the config.
# Defaults to undef
#
class designate::sink (
$package_ensure = present,
$sink_package_name = undef,
$enabled = true,
$service_ensure = 'running',
$package_ensure = present,
$sink_package_name = undef,
$enabled = true,
$service_ensure = 'running',
$enabled_notification_handlers = undef,
) {
include ::designate::params
@ -34,6 +41,16 @@ class designate::sink (
tag => ['openstack', 'designate-package'],
}
if $enabled_notification_handlers {
designate_config {
'service:sink/enabled_notification_handlers': value => join($enabled_notification_handlers,',')
}
} else {
designate_config {
'service:sink/enabled_notification_handlers': ensure => absent
}
}
service { 'designate-sink':
ensure => $service_ensure,
name => $::designate::params::sink_service_name,

View File

@ -24,6 +24,14 @@ describe 'designate::sink' do
:ensure => 'present',
:tag => ['openstack', 'designate-package'],
)
is_expected.to contain_designate_config('service:sink/enabled_notification_handlers').with_ensure('absent')
end
context 'when using enabled_notification_handlers' do
before { params.merge!(:enabled_notification_handlers => ['nova_fixed','neutron_floatingip']) }
it 'configures designate-sink with enabled_notification_handlers' do
is_expected.to contain_designate_config('service:sink/enabled_notification_handlers').with_value(['nova_fixed,neutron_floatingip'])
end
end
end
end