Accept string for enabled_notification_handlers

... in addition to array.

Change-Id: I29d51b4607a457bac91c68be57629e77b86c8651
This commit is contained in:
Takashi Kajinami 2021-12-27 17:38:15 +09:00
parent 8d114592bb
commit a71236859c
2 changed files with 22 additions and 7 deletions

View File

@ -46,11 +46,11 @@ class designate::sink (
if $enabled_notification_handlers {
designate_config {
'service:sink/enabled_notification_handlers': value => join($enabled_notification_handlers,',')
'service:sink/enabled_notification_handlers': value => join(any2array($enabled_notification_handlers),',')
}
} else {
designate_config {
'service:sink/enabled_notification_handlers': ensure => absent
'service:sink/enabled_notification_handlers': ensure => absent
}
}

View File

@ -26,12 +26,27 @@ describe 'designate::sink' do
)
is_expected.to contain_designate_config('service:sink/enabled_notification_handlers').with_ensure('absent')
end
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
context 'with enabled_notification_handlers (array)' do
before do
params.merge!(
:enabled_notification_handlers => ['nova_fixed', 'neutron_floatingip']
)
end
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
context 'with enabled_notification_handlers (string)' do
before do
params.merge!(
:enabled_notification_handlers => 'nova_fixed,neutron_floatingip'
)
end
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