Fix rendering of [watcher_decision_engine] notification_topics

This option accepts a commma-separated list, instead of a multi-valued
string.

Change-Id: I3747365d7f57bf399bbdde56b62963000087f8e0
Signed-off-by: Takashi Kajinami <kajinamit@oss.nttdata.com>
This commit is contained in:
Takashi Kajinami
2025-08-24 03:07:59 +09:00
parent ec8185590e
commit a354c6bd5c
2 changed files with 3 additions and 11 deletions

View File

@@ -72,14 +72,6 @@ class watcher::decision_engine (
$weights_real = join(any2array($weights), ',')
}
if !is_service_default($decision_engine_notification_topics) or
empty($decision_engine_notification_topics) {
warning('$decision_engine_notification_topics needs to be an array')
$decision_engine_notification_topics_real = any2array($decision_engine_notification_topics)
} else {
$decision_engine_notification_topics_real = $decision_engine_notification_topics
}
package { 'watcher-decision-engine':
ensure => $package_ensure,
name => $watcher::params::decision_engine_package_name,
@@ -106,7 +98,7 @@ class watcher::decision_engine (
watcher_config {
'watcher_decision_engine/conductor_topic': value => $decision_engine_conductor_topic;
'watcher_decision_engine/status_topic': value => $decision_engine_status_topic;
'watcher_decision_engine/notification_topics': value => $decision_engine_notification_topics_real;
'watcher_decision_engine/notification_topics': value => join(any2array($decision_engine_notification_topics), ',');
'watcher_decision_engine/publisher_id': value => $decision_engine_publisher_id;
'watcher_decision_engine/max_workers': value => $decision_engine_workers;
}

View File

@@ -17,7 +17,7 @@ describe 'watcher::decision_engine' do
it 'configures watcher decision engine service' do
is_expected.to contain_watcher_config('watcher_decision_engine/conductor_topic').with_value('<SERVICE DEFAULT>')
is_expected.to contain_watcher_config('watcher_decision_engine/status_topic').with_value('<SERVICE DEFAULT>')
is_expected.to contain_watcher_config('watcher_decision_engine/notification_topics').with_value(['<SERVICE DEFAULT>'])
is_expected.to contain_watcher_config('watcher_decision_engine/notification_topics').with_value('<SERVICE DEFAULT>')
is_expected.to contain_watcher_config('watcher_decision_engine/publisher_id').with_value('<SERVICE DEFAULT>')
is_expected.to contain_watcher_config('watcher_decision_engine/max_workers').with_value('<SERVICE DEFAULT>')
is_expected.to contain_watcher_config('watcher_planner/planner').with_value('<SERVICE DEFAULT>')
@@ -78,7 +78,7 @@ describe 'watcher::decision_engine' do
it 'configures watcher decision engine' do
is_expected.to contain_watcher_config('watcher_decision_engine/conductor_topic').with_value('test_conductor_topic')
is_expected.to contain_watcher_config('watcher_decision_engine/status_topic').with_value('niceTopic')
is_expected.to contain_watcher_config('watcher_decision_engine/notification_topics').with_value(['topic_1','topic_2'])
is_expected.to contain_watcher_config('watcher_decision_engine/notification_topics').with_value('topic_1,topic_2')
is_expected.to contain_watcher_config('watcher_decision_engine/publisher_id').with_value('123456')
is_expected.to contain_watcher_config('watcher_decision_engine/max_workers').with_value('10')
is_expected.to contain_watcher_config('watcher_planner/planner').with_value('NoPlanner')