Browse Source

Add default_transport_url option

Change-Id: I891570dde75dc58f45e5ad6386be9e522b2706eb
(cherry picked from commit 1b123d9be5)
tags/9.5.0^0
Alex Schultz 2 years ago
parent
commit
b59fc5506a
2 changed files with 22 additions and 0 deletions
  1. 10
    0
      manifests/notify/rabbitmq.pp
  2. 12
    0
      spec/classes/glance_notify_rabbitmq_spec.rb

+ 10
- 0
manifests/notify/rabbitmq.pp View File

@@ -1,6 +1,12 @@
1 1
 #
2 2
 # used to configure rabbitmq notifications for glance
3 3
 #
4
+# [*default_transport_url*]
5
+#    (optional) A URL representing the messaging driver to use and its full
6
+#    configuration. Transport URLs take the form:
7
+#      transport://user:pass@host1:port[,hostN:portN]/virtual_host
8
+#    Defaults to $::os_service_default
9
+#
4 10
 #  [*rabbit_password*]
5 11
 #   (Optional) The RabbitMQ password. (string value)
6 12
 #   Defaults to $::os_service_default
@@ -97,6 +103,7 @@
97 103
 #   Defaults to $::os_service_default
98 104
 #
99 105
 class glance::notify::rabbitmq(
106
+  $default_transport_url              = $::os_service_default,
100 107
   $rabbit_password                    = $::os_service_default,
101 108
   $rabbit_userid                      = $::os_service_default,
102 109
   $rabbit_host                        = $::os_service_default,
@@ -141,6 +148,9 @@ class glance::notify::rabbitmq(
141 148
     kombu_compression           => $kombu_compression,
142 149
   }
143 150
 
151
+  oslo::messaging::default { ['glance_api_config', 'glance_registry_config']:
152
+    transport_url => $default_transport_url,
153
+  }
144 154
 
145 155
   oslo::messaging::notifications { ['glance_api_config', 'glance_registry_config']:
146 156
     driver => $notification_driver,

+ 12
- 0
spec/classes/glance_notify_rabbitmq_spec.rb View File

@@ -3,6 +3,7 @@ describe 'glance::notify::rabbitmq' do
3 3
 
4 4
   shared_examples_for 'glance::notify::rabbitmq' do
5 5
     describe 'when defaults with rabbit pass specified' do
6
+      it { is_expected.to contain_glance_api_config('DEFAULT/transport_url').with_value('<SERVICE DEFAULT>') }
6 7
       it { is_expected.to contain_glance_api_config('oslo_messaging_notifications/driver').with_value('<SERVICE DEFAULT>') }
7 8
       it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_password').with_value('<SERVICE DEFAULT>') }
8 9
       it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_password').with_value('<SERVICE DEFAULT>').with_secret(true) }
@@ -19,6 +20,7 @@ describe 'glance::notify::rabbitmq' do
19 20
       it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/heartbeat_rate').with_value('<SERVICE DEFAULT>') }
20 21
       it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('<SERVICE DEFAULT>') }
21 22
 
23
+      it { is_expected.to contain_glance_registry_config('DEFAULT/transport_url').with_value('<SERVICE DEFAULT>') }
22 24
       it { is_expected.to contain_glance_registry_config('oslo_messaging_notifications/driver').with_value('<SERVICE DEFAULT>') }
23 25
       it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/rabbit_password').with_value('<SERVICE DEFAULT>') }
24 26
       it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/rabbit_password').with_value('<SERVICE DEFAULT>').with_secret(true) }
@@ -191,6 +193,16 @@ describe 'glance::notify::rabbitmq' do
191 193
       it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/heartbeat_rate').with_value('10') }
192 194
     end
193 195
 
196
+    describe 'when passing params transport_url' do
197
+      let :params do
198
+        {
199
+          :default_transport_url => 'rabbit://user:pass@host:1234/virt',
200
+        }
201
+      end
202
+      it { is_expected.to contain_glance_api_config('DEFAULT/transport_url').with_value('rabbit://user:pass@host:1234/virt') }
203
+      it { is_expected.to contain_glance_registry_config('DEFAULT/transport_url').with_value('rabbit://user:pass@host:1234/virt') }
204
+    end
205
+
194 206
   end
195 207
 
196 208
   on_supported_os({

Loading…
Cancel
Save