]> review.fuel-infra Code Review - puppet-modules/puppet-ceilometer.git/commitdiff
Add transport_url parameters for oslo.messaging
authorAndrew Smith <ansmith@redhat.com>
Mon, 30 May 2016 16:09:59 +0000 (12:09 -0400)
committerAndrew Smith <ansmith@redhat.com>
Mon, 30 May 2016 16:09:59 +0000 (12:09 -0400)
This commit adds the transport_url parameters for oslo.messaging. The
url is of the form:

  transport://user:pass@host1:port[,hostN:portN]/virtual_host

Where the transport scheme specifies the rpc or notification backend
as one of rabbit, amqp, zmq, etc. Oslo.messaging is deprecating the
host, port, and auth configuration options [1]. All drivers will get
these options via the transport_url.

This patch:
* use oslo::messaging::default resource
* use oslo::messaging::notifications resource
* add parameters for transport_url(s)
* update spec tests
* add feature release note

[1] https://review.openstack.org/#/c/317285/

Change-Id: Iaaae758ffc6866e94c63251d2c9bd4af086f32cc

manifests/init.pp
releasenotes/notes/add_transport_url_parameters-8c4c520e5cce0edc.yaml [new file with mode: 0644]
spec/classes/ceilometer_init_spec.rb

index eabb9072c6b10493820c19470e966a901404e5ab..8498bac168160d68af17893be47e67564c3ef7d0 100644 (file)
 #    (Optional) Syslog facility to receive log lines.
 #    Defaults to undef.
 #
+# [*default_transport_url*]
+#    (optional) A URL representing the messaging driver to use and its full
+#    configuration. Transport URLs take the form:
+#      transport://user:pass@host1:port[,hostN:portN]/virtual_host
+#    Defaults to $::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:
+#     transport://user:pass@host1:port[,hostN:portN]/virtual_host
+#   Defaults to $::os_service_default
+#
 #  [*rpc_backend*]
 #    The messaging driver to use, defaults to rabbit. Other drivers include
 #    amqp and zmq. (string value)
@@ -227,6 +239,8 @@ class ceilometer(
   $log_dir                            = undef,
   $use_stderr                         = undef,
   $log_facility                       = undef,
+  $default_transport_url              = $::os_service_default,
+  $notification_transport_url         = $::os_service_default,
   $rpc_backend                        = $::os_service_default,
   $rabbit_host                        = $::os_service_default,
   $rabbit_port                        = $::os_service_default,
@@ -369,7 +383,14 @@ class ceilometer(
     'database/metering_time_to_live'      : value => $metering_time_to_live;
   }
 
-  oslo::messaging::notifications { 'ceilometer_config': topics => $notification_topics }
+  oslo::messaging::notifications { 'ceilometer_config':
+    transport_url => $notification_transport_url,
+    topics        => $notification_topics,
+  }
+
+  oslo::messaging::default { 'ceilometer_config':
+    transport_url => $default_transport_url,
+  }
 
   oslo::cache { 'ceilometer_config':
     memcache_servers => $memcached_servers,
diff --git a/releasenotes/notes/add_transport_url_parameters-8c4c520e5cce0edc.yaml b/releasenotes/notes/add_transport_url_parameters-8c4c520e5cce0edc.yaml
new file mode 100644 (file)
index 0000000..a721368
--- /dev/null
@@ -0,0 +1,3 @@
+---
+features:
+  - Add oslo.messaging transport_url parameters via puppet-oslo resource
\ No newline at end of file
index 19cf05e20d5352b2cd4f8553b6a7feb16ccfa100..18b61dabf31d3456fa49a2e2f62489167b0a68e8 100644 (file)
@@ -115,8 +115,13 @@ describe 'ceilometer' do
       it { expect { is_expected.to raise_error(Puppet::Error) } }
     end
 
-    it 'configures notification_topics' do
+    it 'configures default transport_url' do
+      is_expected.to contain_ceilometer_config('DEFAULT/transport_url').with_value('<SERVICE DEFAULT>')
+    end
+
+    it 'configures notifications' do
       is_expected.to contain_ceilometer_config('oslo_messaging_notifications/topics').with_value('notifications')
+      is_expected.to contain_ceilometer_config('oslo_messaging_notifications/transport_url').with_value('<SERVICE DEFAULT>')
     end
 
     context 'with rabbitmq durable queues configured' do
@@ -124,11 +129,25 @@ describe 'ceilometer' do
       it_configures 'rabbit with durable queues'
     end
 
-    context 'with overriden notification_topics parameter' do
-      before { params.merge!( :notification_topics => ['notifications', 'custom']) }
+    context 'with overriden transport_url parameter' do
+      before { params.merge!( :default_transport_url => 'rabbit://rabbit_user:password@localhost:5673' ) }
+
+      it 'configures transport_url' do
+        is_expected.to contain_ceilometer_config('DEFAULT/transport_url').with_value('rabbit://rabbit_user:password@localhost:5673')
+      end
+    end
+
+    context 'with overriden notification parameters' do
+      before {
+        params.merge!(
+          :notification_topics        => ['notifications', 'custom'],
+          :notification_transport_url => 'rabbit://rabbit_user:password@localhost:5673',
+        )
+      }
 
-      it 'configures notification_topics' do
+      it 'configures notifications' do
         is_expected.to contain_ceilometer_config('oslo_messaging_notifications/topics').with_value('notifications,custom')
+        is_expected.to contain_ceilometer_config('oslo_messaging_notifications/transport_url').with_value('rabbit://rabbit_user:password@localhost:5673')
       end
     end
   end