Remove deprecated rabbit opts in swift::proxy::ceilometer

Removes the deprecated rabbit options in the
swift::proxy::ceilometer class.

Change-Id: I44a2709ed111340dfbb1d751198649c7dd229d7b
This commit is contained in:
Tobias Urdin 2018-10-21 17:40:44 +02:00
parent 82503a419f
commit ef46b58da2
3 changed files with 32 additions and 93 deletions

View File

@ -102,33 +102,6 @@
# available on some distributions. (string value)
# Defaults to $::os_service_default
#
# === DEPRECATED PARAMETERS
#
# [*rabbit_host*]
# (Optional) IP or hostname of the rabbit server.
# Defaults to '127.0.0.1'.
#
# [*rabbit_port*]
# (Optional) Port of the rabbit server.
# Defaults to 5672.
#
# [*rabbit_hosts*]
# (Optional) IP or hostname of the rabbits servers.
# comma separated array (ex: ['1.0.0.10:5672','1.0.0.11:5672'])
# Defaults to undef.
#
# [*rabbit_user*]
# (Optional) Username for rabbit.
# Defaults to 'guest'.
#
# [*rabbit_password*]
# (Optional) Password for rabbit user.
# Defaults to 'guest'.
#
# [*rabbit_virtual_host*]
# (Optional) Virtual host to use.
# Defaults to '/'.
#
# == Examples
#
# == Authors
@ -162,38 +135,10 @@ class swift::proxy::ceilometer(
$amqp_ssl_key_password = $::os_service_default,
$rabbit_use_ssl = $::os_service_default,
$kombu_ssl_version = $::os_service_default,
# DEPRECATED PARAMETERS
$rabbit_user = 'guest',
$rabbit_password = 'guest',
$rabbit_host = '127.0.0.1',
$rabbit_port = '5672',
$rabbit_hosts = undef,
$rabbit_virtual_host = '/',
) inherits swift {
include ::swift::deps
if $default_transport_url {
$amqp_url = $default_transport_url
} else {
warning("swift::proxy::ceilometer::rabbit_host,
swift::proxy::ceilometer::rabbit_hosts, swift::proxy::ceilometer::rabbit_password, \
swift::proxy::ceilometer::rabbit_port, swift::proxy::ceilometer::rabbit_userid \
and swift::proxy::ceilometer::rabbit_virtual_host are \
deprecated. Please use swift::proxy::ceilometer::default_transport_url instead.")
if(is_array($rabbit_hosts)) {
$rabbit_hosts_with_creds = prefix($rabbit_hosts, "${rabbit_user}:${rabbit_password}@")
}
if !$rabbit_hosts {
$amqp_url = "rabbit://${rabbit_user}:${rabbit_password}@${rabbit_host}:${rabbit_port}/${rabbit_virtual_host}"
} else {
$hosts = join($rabbit_hosts_with_creds, ',')
$amqp_url = "rabbit://${hosts}/${rabbit_virtual_host}"
}
}
User['swift'] {
groups +> $group,
}
@ -215,7 +160,7 @@ deprecated. Please use swift::proxy::ceilometer::default_transport_url instead."
swift_proxy_config {
'filter:ceilometer/topic': value => $topic;
'filter:ceilometer/driver': value => $driver;
'filter:ceilometer/url': value => $amqp_url, secret => true;
'filter:ceilometer/url': value => $default_transport_url, secret => true;
'filter:ceilometer/control_exchange': value => $control_exchange;
'filter:ceilometer/paste.filter_factory': value => 'ceilometermiddleware.swift:filter_factory';
'filter:ceilometer/nonblocking_notify': value => $nonblocking_notify;
@ -230,7 +175,7 @@ deprecated. Please use swift::proxy::ceilometer::default_transport_url instead."
'filter:ceilometer/password': value => $password;
}
if $amqp_url =~ /^rabbit.*/ {
if $default_transport_url =~ /^rabbit.*/ {
oslo::messaging::rabbit {'swift_proxy_config':
kombu_ssl_ca_certs => $notification_ssl_ca_file,
kombu_ssl_certfile => $notification_ssl_cert_file,
@ -238,7 +183,7 @@ deprecated. Please use swift::proxy::ceilometer::default_transport_url instead."
kombu_ssl_version => $kombu_ssl_version,
rabbit_use_ssl => $rabbit_use_ssl,
}
} elsif $amqp_url =~ /^amqp.*/ {
} elsif $default_transport_url =~ /^amqp.*/ {
oslo::messaging::amqp {'swift_proxy_config':
ssl_ca_file => $notification_ssl_ca_file,
ssl_cert_file => $notification_ssl_cert_file,

View File

@ -0,0 +1,6 @@
---
upgrade:
- |
The deprecated options rabbit_host, rabbit_hosts, rabbit_password,
rabbit_port, rabbit_userid and rabbit_virtual_host in
swift::proxy::ceilometer has been removed.

View File

@ -10,8 +10,14 @@ describe 'swift::proxy::ceilometer' do
shared_examples 'swift::proxy::ceilometer' do
describe "when using default parameters" do
let :params do
{
:default_transport_url => 'rabbit://user_1:user_1_passw@1.1.1.1:5673/rabbit',
}
end
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/paste.filter_factory').with_value('ceilometermiddleware.swift:filter_factory') }
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/url').with_value('rabbit://guest:guest@127.0.0.1:5672//') }
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/url').with_value('rabbit://user_1:user_1_passw@1.1.1.1:5673/rabbit').with_secret(true) }
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/nonblocking_notify').with_value('false') }
it { is_expected.to contain_user('swift').with_groups('ceilometer') }
it { is_expected.to contain_file('/var/log/ceilometer/swift-proxy-server.log').with(:owner => 'swift', :group => 'swift', :mode => '0664') }
@ -20,11 +26,7 @@ describe 'swift::proxy::ceilometer' do
describe "when overriding default parameters with rabbit driver" do
let :params do
{ :group => 'www-data',
:rabbit_user => 'user_1',
:rabbit_password => 'user_1_passw',
:rabbit_host => '1.1.1.1',
:rabbit_port => '5673',
:rabbit_virtual_host => 'rabbit',
:default_transport_url => 'rabbit://user_1:user_1_passw@1.1.1.1:5673/rabbit',
:driver => 'messagingv2',
:topic => 'notifications',
:control_exchange => 'swift',
@ -44,7 +46,7 @@ describe 'swift::proxy::ceilometer' do
context 'with single rabbit host' do
it { is_expected.to contain_user('swift').with_groups('www-data') }
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/paste.filter_factory').with_value('ceilometermiddleware.swift:filter_factory') }
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/url').with_value('rabbit://user_1:user_1_passw@1.1.1.1:5673/rabbit') }
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/url').with_value('rabbit://user_1:user_1_passw@1.1.1.1:5673/rabbit').with_secret(true) }
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/driver').with_value('messagingv2') }
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/topic').with_value('notifications') }
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/control_exchange').with_value('swift') }
@ -60,20 +62,6 @@ describe 'swift::proxy::ceilometer' do
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/password').with_value('password') }
end
context 'with multiple rabbit hosts' do
before do
params.merge!({ :rabbit_hosts => ['127.0.0.1:5672', '127.0.0.2:5672'] })
end
it { is_expected.to contain_user('swift').with_groups('www-data') }
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/paste.filter_factory').with_value('ceilometermiddleware.swift:filter_factory') }
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/url').with_value('rabbit://user_1:user_1_passw@127.0.0.1:5672,user_1:user_1_passw@127.0.0.2:5672/rabbit') }
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/driver').with_value('messagingv2') }
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/topic').with_value('notifications') }
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/control_exchange').with_value('swift') }
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/nonblocking_notify').with_value('true') }
end
context 'with default transport url' do
before do
params.merge!({ :default_transport_url => 'rabbit://user:pass@host:1234/virt' })