From 5e190fcb8250aa68a80b9d89bf5dca725409ca4c Mon Sep 17 00:00:00 2001 From: Timur Nurlygayanov Date: Tue, 30 Jun 2015 13:45:31 +0300 Subject: [PATCH] Fixed issue with rabbit_hosts parameter We should initialize rabbit_hosts parameter with array, not with string or boolen value. Change-Id: Iab51d77c35fb78f70060115e0ca48238f6f9de50 Closes-Bug: #1470054 --- manifests/init.pp | 5 +++-- manifests/manage/cells.pp | 4 ++-- spec/classes/nova_init_spec.rb | 11 +++++++++++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index a62271b6f..6b7339c74 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -46,7 +46,7 @@ # # [*rabbit_hosts*] # (optional) List of clustered rabbit servers. -# Defaults to false +# Defaults to undef # # [*rabbit_port*] # (optional) Port for rabbitmq instance. @@ -276,7 +276,7 @@ class nova( $glance_api_servers = 'localhost:9292', $memcached_servers = false, $rabbit_host = 'localhost', - $rabbit_hosts = false, + $rabbit_hosts = undef, $rabbit_password = 'guest', $rabbit_port = '5672', $rabbit_userid = 'guest', @@ -526,6 +526,7 @@ class nova( nova_config { 'oslo_messaging_rabbit/rabbit_port': value => $rabbit_port } nova_config { 'oslo_messaging_rabbit/rabbit_hosts': value => "${rabbit_host}:${rabbit_port}" } } + if $rabbit_ha_queues == undef { if $rabbit_hosts { nova_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => true } diff --git a/manifests/manage/cells.pp b/manifests/manage/cells.pp index 9114904b3..b51455275 100644 --- a/manifests/manage/cells.pp +++ b/manifests/manage/cells.pp @@ -41,7 +41,7 @@ # # [*rabbit_hosts*] # (optional) Address of the message broker in this cell -# Defaults to 'localhost' +# Defaults to ['localhost'] # # [*rabbit_port*] # (optional) Port number of the message broker in this cell @@ -64,7 +64,7 @@ define nova::manage::cells ( $cell_parent_name = undef, $rabbit_username = 'guest', $rabbit_password = 'guest', - $rabbit_hosts = 'localhost', + $rabbit_hosts = ['localhost'], $rabbit_port = '5672', $rabbit_virtual_host = '/', $weight_offset = '1.0', diff --git a/spec/classes/nova_init_spec.rb b/spec/classes/nova_init_spec.rb index f8c3067d2..fdb52d74f 100644 --- a/spec/classes/nova_init_spec.rb +++ b/spec/classes/nova_init_spec.rb @@ -269,6 +269,17 @@ describe 'nova' do end end + context 'with rabbit_ha_queues set to false and with rabbit_hosts' do + let :params do + { :rabbit_ha_queues => 'false', + :rabbit_hosts => ['rabbit:5673'] } + end + + it 'configures rabbit' do + is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value(false) + end + end + context 'with amqp_durable_queues parameter' do let :params do { :rabbit_hosts => ['rabbit:5673'],