messaging: add cluster_node_type param

Allow the end-user to choose starting RabbitMQ in RAM or on the disk.
Backward compatible since the default value is to 'disk'.

Signed-off-by: Emilien Macchi <emilien.macchi@enovance.com>
This commit is contained in:
Emilien Macchi
2014-04-09 13:01:15 +02:00
parent b56cd59ff6
commit 6ac991e465
2 changed files with 24 additions and 6 deletions

View File

@@ -27,10 +27,15 @@
# (optional) Password to connect to OpenStack queues. # (optional) Password to connect to OpenStack queues.
# Default value in params # Default value in params
# #
# [*cluster_node_type*]
# (optionnal) Store the queues on the disc or in the RAM.
# Could be set to 'disk' or 'ram'.
# Defaults to 'disc'
class cloud::messaging( class cloud::messaging(
$rabbit_names = $os_params::rabbit_names, $rabbit_names = $os_params::rabbit_names,
$rabbit_password = $os_params::rabbit_password $rabbit_password = $os_params::rabbit_password,
$cluster_node_type = 'disc'
){ ){
class { 'rabbitmq': class { 'rabbitmq':
@@ -38,6 +43,7 @@ class cloud::messaging(
config_cluster => true, config_cluster => true,
cluster_nodes => $rabbit_names, cluster_nodes => $rabbit_names,
wipe_db_on_cookie_change => true, wipe_db_on_cookie_change => true,
cluster_node_type => $cluster_node_type
} }
rabbitmq_vhost { '/': rabbitmq_vhost { '/':

View File

@@ -24,20 +24,32 @@ describe 'cloud::messaging' do
let :params do let :params do
{ {
:rabbit_names => ['foo','boo','zoo'], :rabbit_names => ['foo','boo','zoo'],
:rabbit_password => 'secrete' :rabbit_password => 'secrete',
:cluster_node_type => 'disc'
} }
end end
it 'configure rabbitmq-server' do it 'configure rabbitmq-server with default values' do
should contain_class('rabbitmq').with( should contain_class('rabbitmq').with(
:delete_guest_user => true, :delete_guest_user => true,
:config_cluster => true, :config_cluster => true,
:cluster_nodes => params[:rabbit_names], :cluster_nodes => params[:rabbit_names],
:wipe_db_on_cookie_change => true :wipe_db_on_cookie_change => true,
:cluster_node_type => 'disc'
) )
end end
context 'with RAM mode' do
before :each do
params.merge!( :cluster_node_type => 'ram')
end
it 'configure rabbitmq-server in RAM mode' do
should contain_class('rabbitmq').with( :cluster_node_type => 'ram' )
end
end
end end
context 'on Debian platforms' do context 'on Debian platforms' do