Add an option to not configure RabbitMQ service.

W/o this change we cannot drop a RabbitMQ service (cluster)
installation and configuration from Nova module.
We want Nova 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: I31984e2ca1b2959d9e58c02db620f56931d38e7b
Signed-off-by: Bogdan Dobrelya <bdobrelia@mirantis.com>
This commit is contained in:
Bogdan Dobrelya
2015-01-02 13:44:33 +01:00
parent 21f5e9a4bc
commit 87be273bcf
2 changed files with 44 additions and 21 deletions

View File

@@ -30,9 +30,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 nova::rabbitmq(
@@ -42,12 +44,10 @@ class nova::rabbitmq(
$virtual_host ='/',
$cluster_disk_nodes = false,
$enabled = true,
# DEPRECATED PARAMETER
$rabbitmq_class = 'rabbitmq::server'
) {
# only configure nova after the queue is up
Class[$rabbitmq_class] -> Anchor<| title == 'nova-start' |>
if ($enabled) {
if $userid == 'guest' {
$delete_guest_user = false
@@ -57,7 +57,6 @@ class nova::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}":
@@ -72,27 +71,36 @@ class nova::rabbitmq(
$service_ensure = 'stopped'
}
if $cluster_disk_nodes {
class { $rabbitmq_class:
service_ensure => $service_ensure,
port => $port,
delete_guest_user => $delete_guest_user,
config_cluster => true,
cluster_disk_nodes => $cluster_disk_nodes,
wipe_db_on_cookie_change => true,
}
} else {
class { $rabbitmq_class:
service_ensure => $service_ensure,
port => $port,
delete_guest_user => $delete_guest_user,
# NOTE(bogdando) do not nova manage rabbitmq service
# if rabbitmq_class is set to False
if $rabbitmq_class {
warning('The rabbitmq_class parameter is deprecated.')
if $cluster_disk_nodes {
class { $rabbitmq_class:
service_ensure => $service_ensure,
port => $port,
delete_guest_user => $delete_guest_user,
config_cluster => true,
cluster_disk_nodes => $cluster_disk_nodes,
wipe_db_on_cookie_change => true,
}
} else {
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 nova after the queue is up
Class[$rabbitmq_class] -> Anchor<| title == 'nova-start' |>
}
if ($enabled) {
rabbitmq_vhost { $virtual_host:
provider => 'rabbitmqctl',
require => Class[$rabbitmq_class],
}
}
}

View File

@@ -101,5 +101,20 @@ describe 'nova::rabbitmq' do
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