From: Javier Pena Date: Fri, 26 Jun 2015 12:40:33 +0000 (+0200) Subject: Simplify parameters for rpc_backend X-Git-Tag: 7.0.0-mos-rc1~18 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=56cacb4a65ffa1bd795cbdbffef4c2071a54a411;p=puppet-modules%2Fpuppet-ceilometer.git Simplify parameters for rpc_backend 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 --- diff --git a/manifests/init.pp b/manifests/init.pp index 3769f3c..de8b740 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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; diff --git a/spec/classes/ceilometer_init_spec.rb b/spec/classes/ceilometer_init_spec.rb index 594fbb0..6ca5120 100644 --- a/spec/classes/ceilometer_init_spec.rb +++ b/spec/classes/ceilometer_init_spec.rb @@ -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) } }