Add an option to not configure RabbitMQ service.
W/o this change we cannot drop a RabbitMQ service (cluster) installation and configuration from Cinder module. We want Cinder module to has an option to configure only users, rights, vhosts but not the AMQP cluster itself (this part should be moved to some other modules). The solution is: * add a False value for the rabbitmq_class parameter and skip all of the related configuration steps, if the False value was specified. * Deprecate rabbitmq_class parameter. Closes-bug: #1407077 Change-Id: Ie13123f01fc4a2079dd7ef6622675b7e8c7f417e Signed-off-by: Bogdan Dobrelya <bdobrelia@mirantis.com>
This commit is contained in:
parent
1fc21c688a
commit
583e7c39c4
@ -25,9 +25,11 @@
|
||||
# Defaults to false
|
||||
#
|
||||
# [*rabbitmq_class*]
|
||||
# (optional) The rabbitmq puppet class to depend on,
|
||||
# (optional) Deprecated. The rabbitmq puppet class to depend on,
|
||||
# which is dependent on the puppet-rabbitmq version.
|
||||
# Use the default for 1.x, use 'rabbitmq' for 3.x
|
||||
# Use the default for 1.x, use 'rabbitmq' for 3.x.
|
||||
# Use false if rabbitmq class should not be configured
|
||||
# here
|
||||
# Defaults to 'rabbitmq::server'
|
||||
#
|
||||
class cinder::rabbitmq(
|
||||
@ -36,12 +38,10 @@ class cinder::rabbitmq(
|
||||
$port = '5672',
|
||||
$virtual_host = '/',
|
||||
$enabled = true,
|
||||
# DEPRECATED PARAMETER
|
||||
$rabbitmq_class = 'rabbitmq::server',
|
||||
) {
|
||||
|
||||
# only configure cinder after the queue is up
|
||||
Class[$rabbitmq_class] -> Anchor<| title == 'cinder-start' |>
|
||||
|
||||
if ($enabled) {
|
||||
if $userid == 'guest' {
|
||||
$delete_guest_user = false
|
||||
@ -51,7 +51,6 @@ class cinder::rabbitmq(
|
||||
admin => true,
|
||||
password => $password,
|
||||
provider => 'rabbitmqctl',
|
||||
require => Class[$rabbitmq_class],
|
||||
}
|
||||
# I need to figure out the appropriate permissions
|
||||
rabbitmq_user_permissions { "${userid}@${virtual_host}":
|
||||
@ -66,16 +65,25 @@ class cinder::rabbitmq(
|
||||
$service_ensure = 'stopped'
|
||||
}
|
||||
|
||||
class { $rabbitmq_class:
|
||||
service_ensure => $service_ensure,
|
||||
port => $port,
|
||||
delete_guest_user => $delete_guest_user,
|
||||
# NOTE(bogdando) do not cinder manage rabbitmq service
|
||||
# if rabbitmq_class is set to False
|
||||
if $rabbitmq_class {
|
||||
warning('The rabbitmq_class parameter is deprecated.')
|
||||
|
||||
class { $rabbitmq_class:
|
||||
service_ensure => $service_ensure,
|
||||
port => $port,
|
||||
delete_guest_user => $delete_guest_user,
|
||||
}
|
||||
Class[$rabbitmq_class] -> Rabbitmq_user<| title == $userid |>
|
||||
Class[$rabbitmq_class] -> Rabbitmq_vhost<| title == $virtual_host |>
|
||||
# only configure cinder after the queue is up
|
||||
Class[$rabbitmq_class] -> Anchor<| title == 'cinder-start' |>
|
||||
}
|
||||
|
||||
if ($enabled) {
|
||||
rabbitmq_vhost { $virtual_host:
|
||||
provider => 'rabbitmqctl',
|
||||
require => Class[$rabbitmq_class],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -77,5 +77,18 @@ describe 'cinder::rabbitmq' do
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when no rabbitmq class specified' do
|
||||
|
||||
let :params do
|
||||
{
|
||||
:rabbitmq_class => false
|
||||
}
|
||||
end
|
||||
|
||||
it 'should not contain rabbitmq class calls' do
|
||||
should_not contain_class('rabbitmq::server')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user