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
This commit is contained in:
Javier Pena 2015-06-26 14:40:33 +02:00
parent 58afd380d1
commit 56cacb4a65
2 changed files with 18 additions and 6 deletions

View 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;

View 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) } }