From b3e882849077bff05cf06442d1845e215d08a80c Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Sun, 24 Aug 2025 15:58:21 +0900 Subject: [PATCH] Add support for [DEFAULT] host option Change-Id: If07119d76f6e2c5efa2e57dcab1dc35cc9e88f7e Signed-off-by: Takashi Kajinami --- manifests/init.pp | 9 +++++++++ releasenotes/notes/host-1c9b995fa9843ff5.yaml | 4 ++++ spec/classes/magnum_init_spec.rb | 9 +++++++++ 3 files changed, 22 insertions(+) create mode 100644 releasenotes/notes/host-1c9b995fa9843ff5.yaml diff --git a/manifests/init.pp b/manifests/init.pp index e2259c6..2c341da 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -8,6 +8,10 @@ # (Optional) Ensure state for package # Defaults to 'present' # +# [*host*] +# (optional) Name of this node. +# Defaults to $facts['os_service_default']. +# # [*notification_transport_url*] # (Optional) A URL representing the messaging driver to use for notifications # and its full configuration. Transport URLs take the form: @@ -176,6 +180,7 @@ # class magnum ( $package_ensure = 'present', + $host = $facts['os_service_default'], $notification_transport_url = $facts['os_service_default'], $notification_driver = $facts['os_service_default'], $notification_topics = $facts['os_service_default'], @@ -225,6 +230,10 @@ class magnum ( purge => $purge_config, } + magnum_config { + 'DEFAULT/host': value => $host; + } + oslo::messaging::rabbit { 'magnum_config': rabbit_ha_queues => $rabbit_ha_queues, heartbeat_timeout_threshold => $rabbit_heartbeat_timeout_threshold, diff --git a/releasenotes/notes/host-1c9b995fa9843ff5.yaml b/releasenotes/notes/host-1c9b995fa9843ff5.yaml new file mode 100644 index 0000000..07b8c2a --- /dev/null +++ b/releasenotes/notes/host-1c9b995fa9843ff5.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + The new ``magnum::host`` parameter has been added. diff --git a/spec/classes/magnum_init_spec.rb b/spec/classes/magnum_init_spec.rb index 8b28fcd..5b02d21 100644 --- a/spec/classes/magnum_init_spec.rb +++ b/spec/classes/magnum_init_spec.rb @@ -30,6 +30,10 @@ describe 'magnum' do }) end + it 'configures host' do + is_expected.to contain_magnum_config('DEFAULT/host').with_value('') + end + it 'configures rabbit' do is_expected.to contain_oslo__messaging__rabbit('magnum_config').with( :rabbit_ha_queues => '', @@ -73,6 +77,7 @@ describe 'magnum' do context 'with overridden parameters' do let :params do { :package_ensure => 'latest', + :host => 'localhost', :notification_transport_url => 'rabbit://user:pass@host:1234/virt', :notification_topics => 'openstack', :notification_driver => 'messagingv1', @@ -108,6 +113,10 @@ describe 'magnum' do ) end + it 'configures host' do + is_expected.to contain_magnum_config('DEFAULT/host').with_value('localhost') + end + it 'configures rabbit' do is_expected.to contain_oslo__messaging__default('magnum_config').with( :transport_url => 'rabbit://user:pass@host:1234/virt',