From 51c2793738813c0385b08a810e9c54efcda1a739 Mon Sep 17 00:00:00 2001 From: iberezovskiy Date: Tue, 29 Mar 2016 19:16:36 +0300 Subject: [PATCH] Use oslo module for messaging (rabbit) configuration Additonal changes: * switch messaging related parameters to $::os_service_default as they are used in oslo::messaging_rabbit define * update unit tests * update docs for notify::rabbitmq class * drop deprecated rabbit_durable_queues parameter * fix notification parameters according to mitaka config file Change-Id: Ib20c13f136a299c958d9ac064e8ad93ceb0ebd40 --- manifests/notify/rabbitmq.pp | 176 +++++++++--------- metadata.json | 3 +- ...ch_to_oslo_messaging-cb63828d88821378.yaml | 5 + spec/classes/glance_notify_rabbitmq_spec.rb | 129 ++++++++----- 4 files changed, 173 insertions(+), 140 deletions(-) create mode 100644 releasenotes/notes/switch_to_oslo_messaging-cb63828d88821378.yaml diff --git a/manifests/notify/rabbitmq.pp b/manifests/notify/rabbitmq.pp index d7f34521..2cb3f7a2 100644 --- a/manifests/notify/rabbitmq.pp +++ b/manifests/notify/rabbitmq.pp @@ -2,38 +2,41 @@ # used to configure rabbitmq notifications for glance # # [*rabbit_password*] -# password to connect to the rabbit_server. +# (Optional) The RabbitMQ password. (string value) +# Defaults to $::os_service_default # # [*rabbit_userid*] -# user to connect to the rabbit server. Optional. -# Defaults to $::os_service_default. +# (Optional) The RabbitMQ userid. (string value) +# Defaults to $::os_service_default # # [*rabbit_host*] -# ip or hostname of the rabbit server. Optional. -# Defaults to $::os_service_default. +# (Optional) The RabbitMQ broker address where a single node is used. +# (string value) +# Defaults to $::os_service_default # # [*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 $::os_service_default. +# (Optional) RabbitMQ HA cluster host:port pairs. (array value) +# Defaults to $::os_service_default # # [*rabbit_port*] -# port of the rabbit server. Optional. Defaults to $::os_service_default. +# (Optional) The RabbitMQ broker port where a single node is used. +# (port value) +# Defaults to $::os_service_default # # [*rabbit_virtual_host*] -# virtual_host to use. Optional. Defaults to $::os_service_default. +# (Optional) The RabbitMQ virtual host. (string value) +# Defaults to $::os_service_default # # [*rabbit_ha_queues*] -# (optional) Use HA queues in RabbitMQ (x-ha-policy: all). -# Defaults to $::os_service_default. +# (Optional) Use HA queues in RabbitMQ (x-ha-policy: all). If you change this +# option, you must wipe the RabbitMQ database. (boolean value) +# Defaults to $::os_service_default # # [*rabbit_heartbeat_timeout_threshold*] -# (optional) Number of seconds after which the RabbitMQ broker is considered -# down if the heartbeat keepalive fails. Any value >0 enables heartbeats. -# Heartbeating helps to ensure the TCP connection to RabbitMQ isn't silently -# closed, resulting in missed or lost messages from the queue. -# (Requires kombu >= 3.0.7 and amqp >= 1.4.0) -# Defaults to 0 +# (Optional) Number of seconds after which the Rabbit broker is +# considered down if heartbeat's keep-alive fails +# (0 disable the heartbeat). EXPERIMENTAL. (integer value) +# Defaults to $::os_service_default # # [*rabbit_heartbeat_rate*] # (optional) How often during the rabbit_heartbeat_timeout_threshold period to @@ -43,57 +46,68 @@ # Defaults to $::os_service_default. # # [*rabbit_use_ssl*] -# (optional) Connect over SSL for RabbitMQ -# Defaults to $::os_service_default. +# (Optional) Connect over SSL for RabbitMQ. (boolean value) +# Defaults to $::os_service_default # # [*kombu_ssl_ca_certs*] -# (optional) SSL certification authority file (valid only if SSL enabled). -# Defaults to $::os_service_default. +# (Optional) SSL certification authority file (valid only if SSL enabled). +# (string value) +# Defaults to $::os_service_default # # [*kombu_ssl_certfile*] -# (optional) SSL cert file (valid only if SSL enabled). -# Defaults to $::os_service_default. +# (Optional) SSL cert file (valid only if SSL enabled). (string value) +# Defaults to $::os_service_default # # [*kombu_ssl_keyfile*] -# (optional) SSL key file (valid only if SSL enabled). -# Defaults to $::os_service_default. +# (Optional) SSL key file (valid only if SSL enabled). (string value) +# Defaults to $::os_service_default # # [*kombu_ssl_version*] -# (optional) SSL version to use (valid only if SSL enabled). -# Valid values are TLSv1, SSLv23 and SSLv3. SSLv2 may be -# available on some distributions. -# Defaults to $::os_service_default. +# (Optional) SSL version to use (valid only if SSL enabled). ' +# Valid values are TLSv1 and SSLv23. SSLv2, SSLv3, TLSv1_1, +# and TLSv1_2 may be available on some distributions. (string value) +# Defaults to $::os_service_default # # [*kombu_reconnect_delay*] -# (optional) How long to wait before reconnecting in response to an AMQP -# consumer cancel notification. -# Defaults to $::os_service_default. +# (Optional) How long to wait before reconnecting in response +# to an AMQP consumer cancel notification. (floating point value) +# Defaults to $::os_service_default # # [*rabbit_notification_exchange*] -# Defaults to 'glance' +# Exchange name for sending notifications (string value) +# Defaults to $::os_service_default # # [*rabbit_notification_topic*] -# Defaults to 'notifications' -# -# [*rabbit_durable_queues*] -# Defaults to false +# AMQP topic used for OpenStack notifications. (list value) +# Defaults to $::os_service_default # # [*amqp_durable_queues*] -# (Optional) Use durable queues in broker. -# Defaults to $::os_service_default. +# (optional) Define queues as "durable" to rabbitmq. (boolean value) +# Defaults to $::os_service_default +# +# [*kombu_compression*] +# (optional) Possible values are: gzip, bz2. If not set compression will not +# be used. This option may notbe available in future versions. EXPERIMENTAL. +# (string value) +# Defaults to $::os_service_default +# +# [*notification_driver*] +# The Drivers(s) to handle sending notifications. Possible values are +# messaging, messagingv2, routing, log, test, noop (multi valued) +# Defaults to $::os_service_default # # [*notification_driver*] # Notification driver to use. Defaults to $::os_service_default. class glance::notify::rabbitmq( - $rabbit_password, + $rabbit_password = $::os_service_default, $rabbit_userid = $::os_service_default, $rabbit_host = $::os_service_default, $rabbit_port = $::os_service_default, $rabbit_hosts = $::os_service_default, $rabbit_virtual_host = $::os_service_default, $rabbit_ha_queues = $::os_service_default, - $rabbit_heartbeat_timeout_threshold = 0, + $rabbit_heartbeat_timeout_threshold = $::os_service_default, $rabbit_heartbeat_rate = $::os_service_default, $rabbit_use_ssl = $::os_service_default, $kombu_ssl_ca_certs = $::os_service_default, @@ -101,66 +115,44 @@ class glance::notify::rabbitmq( $kombu_ssl_keyfile = $::os_service_default, $kombu_ssl_version = $::os_service_default, $kombu_reconnect_delay = $::os_service_default, - $rabbit_notification_exchange = 'glance', - $rabbit_notification_topic = 'notifications', - $rabbit_durable_queues = false, + $rabbit_notification_exchange = $::os_service_default, + $rabbit_notification_topic = $::os_service_default, $amqp_durable_queues = $::os_service_default, + $kombu_compression = $::os_service_default, $notification_driver = $::os_service_default, ) { - if !$rabbit_use_ssl or is_service_default($rabbit_use_ssl) { - if !is_service_default($kombu_ssl_keyfile) or !is_service_default($kombu_ssl_certfile) or !is_service_default($kombu_ssl_ca_certs) { - notice('Configuration of certificates with $rabbit_use_ssl == false is a useless config') - } + oslo::messaging::rabbit { ['glance_api_config', 'glance_registry_config']: + rabbit_password => $rabbit_password, + rabbit_userid => $rabbit_userid, + rabbit_host => $rabbit_host, + rabbit_port => $rabbit_port, + rabbit_hosts => $rabbit_hosts, + rabbit_virtual_host => $rabbit_virtual_host, + rabbit_ha_queues => $rabbit_ha_queues, + heartbeat_timeout_threshold => $rabbit_heartbeat_timeout_threshold, + heartbeat_rate => $rabbit_heartbeat_rate, + rabbit_use_ssl => $rabbit_use_ssl, + kombu_ssl_ca_certs => $kombu_ssl_ca_certs, + kombu_ssl_certfile => $kombu_ssl_certfile, + kombu_ssl_keyfile => $kombu_ssl_keyfile, + kombu_ssl_version => $kombu_ssl_version, + kombu_reconnect_delay => $kombu_reconnect_delay, + amqp_durable_queues => $amqp_durable_queues, + kombu_compression => $kombu_compression, } - if $rabbit_durable_queues { - warning('The rabbit_durable_queues parameter is deprecated, use amqp_durable_queues.') - $amqp_durable_queues_real = $rabbit_durable_queues - } else { - $amqp_durable_queues_real = $amqp_durable_queues - } - if ! is_service_default($rabbit_hosts) and $rabbit_hosts { - glance_api_config { - 'oslo_messaging_rabbit/rabbit_hosts': value => join(any2array($rabbit_hosts), ','); - 'oslo_messaging_rabbit/rabbit_host': ensure => absent; - 'oslo_messaging_rabbit/rabbit_port': ensure => absent; - } - if size($rabbit_hosts) > 1 and is_service_default($rabbit_ha_queues) { - glance_api_config { - 'oslo_messaging_rabbit/rabbit_ha_queues': value => true; - } - } else { - glance_api_config { - 'oslo_messaging_rabbit/rabbit_ha_queues': value => $rabbit_ha_queues; - } - } - } else { - glance_api_config { - 'oslo_messaging_rabbit/rabbit_host': value => $rabbit_host; - 'oslo_messaging_rabbit/rabbit_port': value => $rabbit_port; - 'oslo_messaging_rabbit/rabbit_hosts': ensure => absent; - 'oslo_messaging_rabbit/rabbit_ha_queues': value => $rabbit_ha_queues; - } + oslo::messaging::notifications { ['glance_api_config', 'glance_registry_config']: + driver => $notification_driver, + topics => $rabbit_notification_topic, } glance_api_config { - 'DEFAULT/notification_driver': value => $notification_driver; - 'oslo_messaging_rabbit/rabbit_virtual_host': value => $rabbit_virtual_host; - 'oslo_messaging_rabbit/rabbit_password': value => $rabbit_password, secret => true; - 'oslo_messaging_rabbit/rabbit_userid': value => $rabbit_userid; - 'oslo_messaging_rabbit/rabbit_notification_exchange': value => $rabbit_notification_exchange; - 'oslo_messaging_rabbit/rabbit_notification_topic': value => $rabbit_notification_topic; - 'oslo_messaging_rabbit/heartbeat_timeout_threshold': value => $rabbit_heartbeat_timeout_threshold; - 'oslo_messaging_rabbit/heartbeat_rate': value => $rabbit_heartbeat_rate; - 'oslo_messaging_rabbit/kombu_reconnect_delay': value => $kombu_reconnect_delay; - 'oslo_messaging_rabbit/rabbit_use_ssl': value => $rabbit_use_ssl; - 'oslo_messaging_rabbit/amqp_durable_queues': value => $amqp_durable_queues_real; - 'oslo_messaging_rabbit/kombu_ssl_version': value => $kombu_ssl_version; - 'oslo_messaging_rabbit/kombu_ssl_ca_certs': value => $kombu_ssl_ca_certs; - 'oslo_messaging_rabbit/kombu_ssl_certfile': value => $kombu_ssl_certfile; - 'oslo_messaging_rabbit/kombu_ssl_keyfile': value => $kombu_ssl_keyfile; + 'oslo_messaging_rabbit/default_notification_exchange': value => $rabbit_notification_exchange; } + glance_registry_config { + 'oslo_messaging_rabbit/default_notification_exchange': value => $rabbit_notification_exchange; + } } diff --git a/metadata.json b/metadata.json index 393d513e..c08ce8fd 100644 --- a/metadata.json +++ b/metadata.json @@ -34,6 +34,7 @@ { "name": "puppetlabs/inifile", "version_requirement": ">=1.0.0 <2.0.0" }, { "name": "openstack/keystone", "version_requirement": ">=8.0.0 <9.0.0" }, { "name": "puppetlabs/stdlib", "version_requirement": ">=4.2.0 <5.0.0" }, - { "name": "openstack/openstacklib", "version_requirement": ">=8.0.0 <9.0.0" } + { "name": "openstack/openstacklib", "version_requirement": ">=8.0.0 <9.0.0" }, + { "name": "openstack/oslo", "version_requirement": "<9.0.0" } ] } diff --git a/releasenotes/notes/switch_to_oslo_messaging-cb63828d88821378.yaml b/releasenotes/notes/switch_to_oslo_messaging-cb63828d88821378.yaml new file mode 100644 index 00000000..31271b30 --- /dev/null +++ b/releasenotes/notes/switch_to_oslo_messaging-cb63828d88821378.yaml @@ -0,0 +1,5 @@ +--- +features: + - Use oslo module for messaging (rabbit) configuration. + Messaging related parameters were switched to $::os_service_default. + Docs string for parameter were updated according to oslo module. diff --git a/spec/classes/glance_notify_rabbitmq_spec.rb b/spec/classes/glance_notify_rabbitmq_spec.rb index 2fcca67d..f0efcd75 100644 --- a/spec/classes/glance_notify_rabbitmq_spec.rb +++ b/spec/classes/glance_notify_rabbitmq_spec.rb @@ -2,29 +2,38 @@ require 'spec_helper' describe 'glance::notify::rabbitmq' do shared_examples_for 'glance::notify::rabbitmq' do - let :pre_condition do - 'class { "glance::api": keystone_password => "pass" }' - end - describe 'when defaults with rabbit pass specified' do - let :params do - {:rabbit_password => 'pass'} - end - it { is_expected.to contain_glance_api_config('DEFAULT/notification_driver').with_value('') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_password').with_value('pass') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_password').with_value(params[:rabbit_password]).with_secret(true) } + it { is_expected.to contain_glance_api_config('oslo_messaging_notifications/driver').with_value('') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_password').with_value('') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_password').with_value('').with_secret(true) } it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_userid').with_value('') } it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_host').with_value('') } it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_port').with_value('') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_hosts').with_ensure('absent') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_hosts').with_value('') } it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('') } it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('') } it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value('') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_notification_exchange').with_value('glance') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_notification_topic').with_value('notifications') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('0') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/default_notification_exchange').with_value('') } + it { is_expected.to contain_glance_api_config('oslo_messaging_notifications/topics').with_value('') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('') } it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/heartbeat_rate').with_value('') } it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('') } + + it { is_expected.to contain_glance_registry_config('oslo_messaging_notifications/driver').with_value('') } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/rabbit_password').with_value('') } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/rabbit_password').with_value('').with_secret(true) } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/rabbit_userid').with_value('') } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/rabbit_host').with_value('') } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/rabbit_port').with_value('') } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/rabbit_hosts').with_value('') } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('') } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('') } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value('') } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/default_notification_exchange').with_value('') } + it { is_expected.to contain_glance_registry_config('oslo_messaging_notifications/topics').with_value('') } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('') } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/heartbeat_rate').with_value('') } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('') } end describe 'when passing params and use ssl' do @@ -46,16 +55,26 @@ describe 'glance::notify::rabbitmq' do it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_value('') } it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_value('') } it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_version').with_value('') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_durable_queues').with_value('true') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_durable_queues').with_value(true) } it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('5.0') } + + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/rabbit_userid').with_value('guest2') } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/rabbit_host').with_value('localhost2') } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/rabbit_port').with_value('5673') } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value(true) } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_value('') } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_value('') } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_value('') } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/kombu_ssl_version').with_value('') } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/rabbit_durable_queues').with_value(true) } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('5.0') } end end describe 'with rabbit ssl cert parameters' do let :params do { - :rabbit_password => 'pass', - :rabbit_use_ssl => 'true', + :rabbit_use_ssl => true, :kombu_ssl_ca_certs => '/etc/ca.cert', :kombu_ssl_certfile => '/etc/certfile', :kombu_ssl_keyfile => '/etc/key', @@ -67,41 +86,58 @@ describe 'glance::notify::rabbitmq' do it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_value('/etc/certfile') } it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_value('/etc/key') } it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_version').with_value('TLSv1') } + + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value(true) } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_value('/etc/ca.cert') } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_value('/etc/certfile') } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_value('/etc/key') } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/kombu_ssl_version').with_value('TLSv1') } end describe 'with rabbit ssl disabled' do let :params do { - :rabbit_password => 'pass', - :rabbit_use_ssl => false, - :kombu_ssl_version => 'TLSv1', + :rabbit_use_ssl => false, } end - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('false') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value(false) } it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_value('') } it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_value('') } it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_value('') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_version').with_value('TLSv1') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_version').with_value('') } + + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value(false) } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_value('') } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_value('') } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_value('') } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/kombu_ssl_version').with_value('') } end describe 'when passing params for single rabbit host' do let :params do { - :rabbit_password => 'pass', - :rabbit_userid => 'guest2', - :rabbit_host => 'localhost2', - :rabbit_port => '5673', - :rabbit_use_ssl => true, - :rabbit_durable_queues => true, + :rabbit_password => 'pass', + :rabbit_userid => 'guest2', + :rabbit_host => 'localhost2', + :rabbit_port => '5673', + :rabbit_use_ssl => true, + :amqp_durable_queues => true, } end it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_userid').with_value('guest2') } it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_host').with_value('localhost2') } it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_port').with_value('5673') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_hosts').with_ensure('absent') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('true') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('true') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_hosts').with_value('') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value(true) } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/amqp_durable_queues').with_value(true) } + + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/rabbit_userid').with_value('guest2') } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/rabbit_host').with_value('localhost2') } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/rabbit_port').with_value('5673') } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/rabbit_hosts').with_value('') } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value(true) } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/amqp_durable_queues').with_value(true) } end describe 'when passing params for multiple rabbit hosts' do @@ -113,11 +149,16 @@ describe 'glance::notify::rabbitmq' do } end it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_userid').with_value('guest3') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_hosts').with_value( - 'nonlocalhost3:5673,nonlocalhost4:5673') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_port').with_ensure('absent') } - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_host').with_ensure('absent') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_hosts').with_value('nonlocalhost3:5673,nonlocalhost4:5673') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value(true) } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_port').with_value('') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_host').with_value('') } + + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/rabbit_userid').with_value('guest3') } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/rabbit_hosts').with_value('nonlocalhost3:5673,nonlocalhost4:5673') } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value(true) } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/rabbit_port').with_value('') } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/rabbit_host').with_value('') } end describe 'a single rabbit_host with enable ha queues' do @@ -131,33 +172,27 @@ describe 'glance::notify::rabbitmq' do it 'should contain rabbit_ha_queues' do is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true') + + is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true') end end describe 'when passing params for rabbitmq heartbeat' do let :params do { - :rabbit_password => 'pass', :rabbit_heartbeat_timeout_threshold => '60', :rabbit_heartbeat_rate => '10', } end it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('60') } it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/heartbeat_rate').with_value('10') } + + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('60') } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/heartbeat_rate').with_value('10') } end - describe 'when using deprecated params' do - let :params do - { - :rabbit_durable_queues => true, - :rabbit_password => 'pass' - } - end - it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('true') } - end end - on_supported_os({ :supported_os => OSDefaults.get_supported_os }).each do |os,facts|