sink: Simplify handling of enabled_notification_handlers

Change-Id: Ifd8b6f19c88fbb411916be0c434127c4a4995f94
This commit is contained in:
Takashi Kajinami 2022-02-28 09:36:02 +09:00
parent 94ec53433d
commit f87bd126b0
3 changed files with 18 additions and 10 deletions

View File

@ -32,7 +32,7 @@
# (optional) List of notification handlers to enable, configuration of # (optional) List of notification handlers to enable, configuration of
# these needs to correspond to a [handler:my_driver] section below or # these needs to correspond to a [handler:my_driver] section below or
# else in the config. # else in the config.
# Defaults to undef # Defaults to $::os_service_default
# #
class designate::sink ( class designate::sink (
$package_ensure = present, $package_ensure = present,
@ -41,7 +41,7 @@ class designate::sink (
$manage_service = true, $manage_service = true,
$workers = $::os_service_default, $workers = $::os_service_default,
$threads = $::os_service_default, $threads = $::os_service_default,
$enabled_notification_handlers = undef, $enabled_notification_handlers = $::os_service_default,
) inherits designate::params { ) inherits designate::params {
include designate::deps include designate::deps
@ -59,14 +59,15 @@ class designate::sink (
'service:sink/threads': value => $threads; 'service:sink/threads': value => $threads;
} }
if $enabled_notification_handlers { if ! $enabled_notification_handlers {
designate_config { warning('Usage of false value for enabled_notification_handlers is deprecated. \
'service:sink/enabled_notification_handlers': value => join(any2array($enabled_notification_handlers),',') Use $::os_service_default instead')
} $enabled_notification_handlers_real = $::os_service_default
} else { } else {
designate_config { $enabled_notification_handlers_real = $enabled_notification_handlers
'service:sink/enabled_notification_handlers': ensure => absent
}
} }
designate_config {
'service:sink/enabled_notification_handlers': value => join(any2array($enabled_notification_handlers_real), ',')
}
} }

View File

@ -0,0 +1,7 @@
---
deprecations:
- |
Support for false value for
the ``designate::sink::enabled_notification_handlers`` parameter has been
deprecated and will be removed in a future release.
Use ``$::os_service_default`` instead.

View File

@ -29,7 +29,7 @@ describe 'designate::sink' do
it 'configures designate.conf' do it 'configures designate.conf' do
is_expected.to contain_designate_config('service:sink/workers').with_value('<SERVICE DEFAULT>') is_expected.to contain_designate_config('service:sink/workers').with_value('<SERVICE DEFAULT>')
is_expected.to contain_designate_config('service:sink/threads').with_value('<SERVICE DEFAULT>') is_expected.to contain_designate_config('service:sink/threads').with_value('<SERVICE DEFAULT>')
is_expected.to contain_designate_config('service:sink/enabled_notification_handlers').with_ensure('absent') is_expected.to contain_designate_config('service:sink/enabled_notification_handlers').with_value('<SERVICE DEFAULT>')
end end
end end