From d65695db3994f531e491bfde51a809f77e52b751 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Sun, 24 Aug 2025 23:37:17 +0900 Subject: [PATCH] Add support for [DEFAULT] host option Change-Id: Iea2f42e68ae71035344877fb58121da02811a41a Signed-off-by: Takashi Kajinami --- manifests/init.pp | 13 +++++++++++-- releasenotes/notes/host-ac5889dbd6c24113.yaml | 4 ++++ spec/classes/watcher_init_spec.rb | 9 +++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/host-ac5889dbd6c24113.yaml diff --git a/manifests/init.pp b/manifests/init.pp index 8d771f5..42d211e 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -5,8 +5,12 @@ # === Parameters: # # [*package_ensure*] -# (optional) Whether the watcher api package will be installed -# Defaults to 'present' +# (optional) Whether the watcher api package will be installed +# Defaults to 'present' +# +# [*host*] +# (optional) Name of this node. +# Defaults to $facts['os_service_default']. # # [*rabbit_login_method*] # (optional) The RabbitMQ login method. (string value) @@ -192,6 +196,7 @@ # class watcher ( $package_ensure = 'present', + $host = $facts['os_service_default'], $rabbit_login_method = $facts['os_service_default'], $rabbit_retry_interval = $facts['os_service_default'], $rabbit_retry_backoff = $facts['os_service_default'], @@ -246,6 +251,10 @@ class watcher ( purge => $purge_config, } + watcher_config { + 'DEFAULT/host': value => $host; + } + oslo::messaging::rabbit { 'watcher_config': amqp_durable_queues => $amqp_durable_queues, kombu_ssl_version => $kombu_ssl_version, diff --git a/releasenotes/notes/host-ac5889dbd6c24113.yaml b/releasenotes/notes/host-ac5889dbd6c24113.yaml new file mode 100644 index 0000000..b747700 --- /dev/null +++ b/releasenotes/notes/host-ac5889dbd6c24113.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + The new ``watcher::host`` parameter has been added. diff --git a/spec/classes/watcher_init_spec.rb b/spec/classes/watcher_init_spec.rb index 68b7701..ac5713e 100644 --- a/spec/classes/watcher_init_spec.rb +++ b/spec/classes/watcher_init_spec.rb @@ -26,6 +26,10 @@ describe 'watcher' do it { is_expected.to contain_class('watcher::policy') } it { is_expected.to contain_class('watcher::deps') } + it 'cofigures common options' do + is_expected.to contain_watcher_config('DEFAULT/host').with_value('') + end + it 'configures messaging' do is_expected.to contain_oslo__messaging__default('watcher_config').with( :transport_url => '', @@ -75,6 +79,7 @@ describe 'watcher' do context 'with overridden parameters' do let :params do { + :host => 'localhost', :default_transport_url => 'rabbit://rabbit_user:password@localhost:5673', :rpc_response_timeout => '120', :control_exchange => 'watcher', @@ -100,6 +105,10 @@ describe 'watcher' do :notification_retry => 10, } end + + it 'cofigures common options' do + is_expected.to contain_watcher_config('DEFAULT/host').with_value('localhost') + end it 'configures messaging' do is_expected.to contain_oslo__messaging__default('watcher_config').with( :transport_url => 'rabbit://rabbit_user:password@localhost:5673',