]> review.fuel-infra Code Review - puppet-modules/puppet-ceilometer.git/commitdiff
Simplify parameters for rpc_backend
authorJavier Pena <jpena@redhat.com>
Fri, 26 Jun 2015 12:40:33 +0000 (14:40 +0200)
committerJavier Pena <jpena@redhat.com>
Mon, 13 Jul 2015 07:51:54 +0000 (09:51 +0200)
It is not needed anymore to specify the whole python namespace
for the backends, and in Liberty this option is completely removed
(see https://review.openstack.org/189201).

This patch keeps backwards compatibility with the previous default
parameters.

Change-Id: I5c84def51bcda593c89c3897c52fb4e8e663e121

manifests/init.pp
spec/classes/ceilometer_init_spec.rb

index 3769f3ce986e8dd68bf8104f0c0819955f7071ce..de8b7405c0135009516a5273aeea92ba71f16a0a 100644 (file)
@@ -27,7 +27,7 @@
 #    Defaults to 'LOG_USER'
 # [*rpc_backend*]
 #    (optional) what rpc/queuing service to use
-#    Defaults to impl_kombu (rabbitmq)
+#    Defaults to 'rabbit'
 #  [*rabbit_host*]
 #    ip or hostname of the rabbit server. Optional. Defaults to '127.0.0.1'
 #  [*rabbit_port*]
@@ -99,7 +99,7 @@ class ceilometer(
   $verbose                            = false,
   $use_syslog                         = false,
   $log_facility                       = 'LOG_USER',
-  $rpc_backend                        = 'ceilometer.openstack.common.rpc.impl_kombu',
+  $rpc_backend                        = 'rabbit',
   $rabbit_host                        = '127.0.0.1',
   $rabbit_port                        = 5672,
   $rabbit_hosts                       = undef,
@@ -182,7 +182,8 @@ class ceilometer(
 
   Package['ceilometer-common'] -> Ceilometer_config<||>
 
-  if $rpc_backend == 'ceilometer.openstack.common.rpc.impl_kombu' {
+  # we keep "ceilometer.openstack.common.rpc.impl_kombu" for backward compatibility
+  if $rpc_backend == 'ceilometer.openstack.common.rpc.impl_kombu' or $rpc_backend == 'rabbit' {
 
     if $rabbit_hosts {
       ceilometer_config { 'oslo_messaging_rabbit/rabbit_host': ensure => absent }
@@ -250,7 +251,8 @@ class ceilometer(
 
   }
 
-  if $rpc_backend == 'ceilometer.openstack.common.rpc.impl_qpid' {
+  # we keep "ceilometer.openstack.common.rpc.impl_qpid" for backward compatibility
+  if $rpc_backend == 'ceilometer.openstack.common.rpc.impl_qpid' or $rpc_backend == 'qpid' {
 
     ceilometer_config {
       'DEFAULT/qpid_hostname'              : value => $qpid_hostname;
index 594fbb09ed58da9be4e6bbd54accd5dae934c16d..6ca5120d17e86f48e54a957fa39aa095518f3997 100644 (file)
@@ -24,7 +24,7 @@ describe 'ceilometer' do
 
   let :qpid_params do
     {
-      :rpc_backend   => "ceilometer.openstack.common.rpc.impl_qpid",
+      :rpc_backend   => 'qpid',
       :qpid_hostname => 'localhost',
       :qpid_port     => 5672,
       :qpid_username => 'guest',
@@ -56,6 +56,11 @@ describe 'ceilometer' do
         it_configures 'rabbit with SSL support'
         it_configures 'rabbit with HA support'
       end
+
+      context("with legacy rpc_backend value") do
+        before { params.merge!( rabbit_params ).merge!(:rpc_backend => 'ceilometer.openstack.common.rpc.impl_kombu') }
+        it { is_expected.to contain_ceilometer_config('DEFAULT/rpc_backend').with_value('ceilometer.openstack.common.rpc.impl_kombu') }
+      end
     end
 
     context 'with qpid' do
@@ -307,7 +312,7 @@ describe 'ceilometer' do
     end
 
     context("with mandatory parameters set") do
-      it { is_expected.to contain_ceilometer_config('DEFAULT/rpc_backend').with_value('ceilometer.openstack.common.rpc.impl_qpid') }
+      it { is_expected.to contain_ceilometer_config('DEFAULT/rpc_backend').with_value('qpid') }
       it { is_expected.to contain_ceilometer_config('DEFAULT/qpid_hostname').with_value( params[:qpid_hostname] ) }
       it { is_expected.to contain_ceilometer_config('DEFAULT/qpid_port').with_value( params[:qpid_port] ) }
       it { is_expected.to contain_ceilometer_config('DEFAULT/qpid_username').with_value( params[:qpid_username]) }
@@ -315,6 +320,11 @@ describe 'ceilometer' do
       it { is_expected.to contain_ceilometer_config('DEFAULT/qpid_password').with_value( params[:qpid_password] ).with_secret(true) }
     end
 
+    context("with legacy rpc_backend value") do
+      before { params.merge!( qpid_params ).merge!(:rpc_backend => 'ceilometer.openstack.common.rpc.impl_qpid') }
+      it { is_expected.to contain_ceilometer_config('DEFAULT/rpc_backend').with_value('ceilometer.openstack.common.rpc.impl_qpid') }
+    end
+
     context("failing if the rpc_backend is not present") do
       before { params.delete( :rpc_backend) }
       it { expect { is_expected.to raise_error(Puppet::Error) } }