From a354c6bd5ccebb89e7a85b8c0c4096b4bc4e0661 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Sun, 24 Aug 2025 03:07:59 +0900 Subject: [PATCH] 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 --- manifests/decision_engine.pp | 10 +--------- spec/classes/watcher_decision_engine_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/manifests/decision_engine.pp b/manifests/decision_engine.pp index b2e9e69..1e92f2e 100644 --- a/manifests/decision_engine.pp +++ b/manifests/decision_engine.pp @@ -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; } diff --git a/spec/classes/watcher_decision_engine_spec.rb b/spec/classes/watcher_decision_engine_spec.rb index 2430115..266b55b 100644 --- a/spec/classes/watcher_decision_engine_spec.rb +++ b/spec/classes/watcher_decision_engine_spec.rb @@ -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('') is_expected.to contain_watcher_config('watcher_decision_engine/status_topic').with_value('') - is_expected.to contain_watcher_config('watcher_decision_engine/notification_topics').with_value(['']) + is_expected.to contain_watcher_config('watcher_decision_engine/notification_topics').with_value('') is_expected.to contain_watcher_config('watcher_decision_engine/publisher_id').with_value('') is_expected.to contain_watcher_config('watcher_decision_engine/max_workers').with_value('') is_expected.to contain_watcher_config('watcher_planner/planner').with_value('') @@ -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')