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
  * fix values for boolean variables
  * specify type for each parameter

Change-Id: I9d03db24fafdd1f5fd2141cdc599b3ab212a04d8
This commit is contained in:
iberezovskiy
2016-03-14 14:29:59 +03:00
parent f0709b7d23
commit 94c3bbed71
4 changed files with 128 additions and 188 deletions

View File

@@ -69,78 +69,85 @@
# Defaults to $::os_service_default. # Defaults to $::os_service_default.
# #
# [*rabbit_host*] # [*rabbit_host*]
# (optional) Location of rabbitmq installation. # (optional) Location of rabbitmq installation. (string value)
# Defaults to 'localhost' # Defaults to 'localhost'
# #
# [*rabbit_hosts*] # [*rabbit_hosts*]
# (optional) List of clustered rabbit servers. # (optional) List of clustered rabbit servers. (string value)
# Defaults to undef # Defaults to $::os_service_default
# #
# [*rabbit_port*] # [*rabbit_port*]
# (optional) Port for rabbitmq instance. # (optional) Port for rabbitmq instance. (port value)
# Defaults to '5672' # Defaults to $::os_service_default
# #
# [*rabbit_password*] # [*rabbit_password*]
# (optional) Password used to connect to rabbitmq. # (optional) Password used to connect to rabbitmq. (string value)
# Defaults to 'guest' # Defaults to $::os_service_default
# #
# [*rabbit_userid*] # [*rabbit_userid*]
# (optional) User used to connect to rabbitmq. # (optional) User used to connect to rabbitmq. (string value)
# Defaults to 'guest' # Defaults to $::os_service_default
# #
# [*rabbit_virtual_host*] # [*rabbit_virtual_host*]
# (optional) The RabbitMQ virtual host. # (optional) The RabbitMQ virtual host. (string value)
# Defaults to '/' # Defaults to $::os_service_default
# #
# [*rabbit_use_ssl*] # [*rabbit_use_ssl*]
# (optional) Connect over SSL for RabbitMQ # (optional) Boolean. Connect over SSL for RabbitMQ. (boolean value)
# Defaults to false # Defaults to $::os_service_default
# #
# [*rabbit_ha_queues*] # [*rabbit_ha_queues*]
# (optional) Use HA queues in RabbitMQ. # (optional) Use HA queues in RabbitMQ. (boolean value)
# Defaults to undef # Defaults to $::os_service_default
# #
# [*rabbit_heartbeat_timeout_threshold*] # [*rabbit_heartbeat_timeout_threshold*]
# (optional) Number of seconds after which the RabbitMQ broker is considered # (optional) Number of seconds after which the RabbitMQ broker is considered
# down if the heartbeat keepalive fails. Any value >0 enables heartbeats. # down if the heartbeat keepalive fails. Any value >0 enables heartbeats.
# Heartbeating helps to ensure the TCP connection to RabbitMQ isn't silently # Heartbeating helps to ensure the TCP connection to RabbitMQ isn't silently
# closed, resulting in missed or lost messages from the queue. # closed, resulting in missed or lost messages from the queue.
# (Requires kombu >= 3.0.7 and amqp >= 1.4.0) # Requires kombu >= 3.0.7 and amqp >= 1.4.0. (integer value)
# Defaults to 0 # Defaults to $::os_service_default
# #
# [*rabbit_heartbeat_rate*] # [*rabbit_heartbeat_rate*]
# (optional) How often during the rabbit_heartbeat_timeout_threshold period to # (optional) How often during the rabbit_heartbeat_timeout_threshold period
# check the heartbeat on RabbitMQ connection. (i.e. rabbit_heartbeat_rate=2 # to check the heartbeat on RabbitMQ connection.
# when rabbit_heartbeat_timeout_threshold=60, the heartbeat will be checked # i.e. rabbit_heartbeat_rate=2 when rabbit_heartbeat_timeout_threshold=60,
# every 30 seconds. # the heartbeat will be checked every 30 seconds. (integer value)
# Defaults to 2 # Defaults to $::os_service_default
# #
# [*kombu_ssl_ca_certs*] # [*kombu_ssl_ca_certs*]
# (optional) SSL certification authority file (valid only if SSL enabled). # (optional) SSL certification authority file (valid only if SSL enabled).
# Defaults to undef # (string value)
# Defaults to $::os_service_default
# #
# [*kombu_ssl_certfile*] # [*kombu_ssl_certfile*]
# (optional) SSL cert file (valid only if SSL enabled). # (optional) SSL cert file (valid only if SSL enabled). (string value)
# Defaults to undef # Defaults to $::os_service_default
# #
# [*kombu_ssl_keyfile*] # [*kombu_ssl_keyfile*]
# (optional) SSL key file (valid only if SSL enabled). # (optional) SSL key file (valid only if SSL enabled). (string value)
# Defaults to undef # Defaults to $::os_service_default
# #
# [*kombu_ssl_version*] # [*kombu_ssl_version*]
# (optional) SSL version to use (valid only if SSL enabled). # (optional) SSL version to use (valid only if SSL enabled).
# Valid values are TLSv1, SSLv23 and SSLv3. SSLv2 may be # Valid values are TLSv1, SSLv23 and SSLv3. SSLv2 may be
# available on some distributions. # available on some distributions. (string value)
# Defaults to 'TLSv1' # Defaults to $::os_service_default
# #
# [*kombu_reconnect_delay*] # [*kombu_reconnect_delay*]
# (optional) How long to wait before reconnecting in response to an AMQP # (optional) How long to wait before reconnecting in response to an AMQP
# consumer cancel notification. # consumer cancel notification. (floating point value)
# Defaults to '1.0' # 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
# #
# [*amqp_durable_queues*] # [*amqp_durable_queues*]
# (optional) Define queues as "durable" to rabbitmq. # (optional) Define queues as "durable" to rabbitmq. (boolean value)
# Defaults to false # Defaults to $::os_service_default
# #
# [*auth_strategy*] # [*auth_strategy*]
# (optional) The strategy to use for auth: noauth or keystone. # (optional) The strategy to use for auth: noauth or keystone.
@@ -354,28 +361,29 @@ class nova(
$database_max_retries = undef, $database_max_retries = undef,
$database_retry_interval = undef, $database_retry_interval = undef,
$database_max_overflow = undef, $database_max_overflow = undef,
$rpc_backend = 'rabbit', $rpc_backend = $::os_service_default,
$image_service = 'nova.image.glance.GlanceImageService', $image_service = 'nova.image.glance.GlanceImageService',
# these glance params should be optional # these glance params should be optional
# this should probably just be configured as a glance client # this should probably just be configured as a glance client
$glance_api_servers = 'http://localhost:9292', $glance_api_servers = 'http://localhost:9292',
$memcached_servers = $::os_service_default, $memcached_servers = $::os_service_default,
$rabbit_host = 'localhost', $rabbit_host = $::os_service_default,
$rabbit_hosts = undef, $rabbit_hosts = $::os_service_default,
$rabbit_password = 'guest', $rabbit_password = $::os_service_default,
$rabbit_port = '5672', $rabbit_port = $::os_service_default,
$rabbit_userid = 'guest', $rabbit_userid = $::os_service_default,
$rabbit_virtual_host = '/', $rabbit_virtual_host = $::os_service_default,
$rabbit_use_ssl = false, $rabbit_use_ssl = $::os_service_default,
$rabbit_heartbeat_timeout_threshold = 0, $rabbit_heartbeat_timeout_threshold = $::os_service_default,
$rabbit_heartbeat_rate = 2, $rabbit_heartbeat_rate = $::os_service_default,
$rabbit_ha_queues = undef, $rabbit_ha_queues = $::os_service_default,
$kombu_ssl_ca_certs = undef, $kombu_ssl_ca_certs = $::os_service_default,
$kombu_ssl_certfile = undef, $kombu_ssl_certfile = $::os_service_default,
$kombu_ssl_keyfile = undef, $kombu_ssl_keyfile = $::os_service_default,
$kombu_ssl_version = 'TLSv1', $kombu_ssl_version = $::os_service_default,
$kombu_reconnect_delay = '1.0', $kombu_reconnect_delay = $::os_service_default,
$amqp_durable_queues = false, $kombu_compression = $::os_service_default,
$amqp_durable_queues = $::os_service_default,
$auth_strategy = 'keystone', $auth_strategy = 'keystone',
$service_down_time = 60, $service_down_time = 60,
$log_dir = undef, $log_dir = undef,
@@ -444,19 +452,6 @@ class nova(
} }
} }
if $kombu_ssl_ca_certs and !$rabbit_use_ssl {
fail('The kombu_ssl_ca_certs parameter requires rabbit_use_ssl to be set to true')
}
if $kombu_ssl_certfile and !$rabbit_use_ssl {
fail('The kombu_ssl_certfile parameter requires rabbit_use_ssl to be set to true')
}
if $kombu_ssl_keyfile and !$rabbit_use_ssl {
fail('The kombu_ssl_keyfile parameter requires rabbit_use_ssl to be set to true')
}
if ($kombu_ssl_certfile and !$kombu_ssl_keyfile) or ($kombu_ssl_keyfile and !$kombu_ssl_certfile) {
fail('The kombu_ssl_certfile and kombu_ssl_keyfile parameters must be used together')
}
if $nova_public_key or $nova_private_key { if $nova_public_key or $nova_private_key {
file { '/var/lib/nova/.ssh': file { '/var/lib/nova/.ssh':
ensure => directory, ensure => directory,
@@ -544,71 +539,28 @@ class nova(
# we keep "nova.openstack.common.rpc.impl_kombu" for backward compatibility # we keep "nova.openstack.common.rpc.impl_kombu" for backward compatibility
# but since Icehouse, "rabbit" is enough. # but since Icehouse, "rabbit" is enough.
if $rpc_backend == 'nova.openstack.common.rpc.impl_kombu' or $rpc_backend == 'rabbit' { if $rpc_backend in [$::os_service_default, 'nova.openstack.common.rpc.impl_kombu', 'rabbit'] {
# I may want to support exporting and collecting these oslo::messaging::rabbit {'nova_config':
nova_config { rabbit_password => $rabbit_password,
'oslo_messaging_rabbit/rabbit_password': value => $rabbit_password, secret => true; rabbit_userid => $rabbit_userid,
'oslo_messaging_rabbit/rabbit_userid': value => $rabbit_userid; rabbit_virtual_host => $rabbit_virtual_host,
'oslo_messaging_rabbit/rabbit_virtual_host': value => $rabbit_virtual_host; rabbit_use_ssl => $rabbit_use_ssl,
'oslo_messaging_rabbit/rabbit_use_ssl': value => $rabbit_use_ssl; heartbeat_timeout_threshold => $rabbit_heartbeat_timeout_threshold,
'oslo_messaging_rabbit/heartbeat_timeout_threshold': value => $rabbit_heartbeat_timeout_threshold; heartbeat_rate => $rabbit_heartbeat_rate,
'oslo_messaging_rabbit/heartbeat_rate': value => $rabbit_heartbeat_rate; kombu_reconnect_delay => $kombu_reconnect_delay,
'oslo_messaging_rabbit/kombu_reconnect_delay': value => $kombu_reconnect_delay; amqp_durable_queues => $amqp_durable_queues,
'oslo_messaging_rabbit/amqp_durable_queues': value => $amqp_durable_queues; kombu_compression => $kombu_compression,
} kombu_ssl_ca_certs => $kombu_ssl_ca_certs,
kombu_ssl_certfile => $kombu_ssl_certfile,
if $rabbit_use_ssl { kombu_ssl_keyfile => $kombu_ssl_keyfile,
kombu_ssl_version => $kombu_ssl_version,
if $kombu_ssl_ca_certs { rabbit_hosts => $rabbit_hosts,
nova_config { 'oslo_messaging_rabbit/kombu_ssl_ca_certs': value => $kombu_ssl_ca_certs; } rabbit_host => $rabbit_host,
} else { rabbit_port => $rabbit_port,
nova_config { 'oslo_messaging_rabbit/kombu_ssl_ca_certs': ensure => absent; } rabbit_ha_queues => $rabbit_ha_queues,
}
if $kombu_ssl_certfile or $kombu_ssl_keyfile {
nova_config {
'oslo_messaging_rabbit/kombu_ssl_certfile': value => $kombu_ssl_certfile;
'oslo_messaging_rabbit/kombu_ssl_keyfile': value => $kombu_ssl_keyfile;
}
} else {
nova_config {
'oslo_messaging_rabbit/kombu_ssl_certfile': ensure => absent;
'oslo_messaging_rabbit/kombu_ssl_keyfile': ensure => absent;
}
}
if $kombu_ssl_version {
nova_config { 'oslo_messaging_rabbit/kombu_ssl_version': value => $kombu_ssl_version; }
} else {
nova_config { 'oslo_messaging_rabbit/kombu_ssl_version': ensure => absent; }
}
} else {
nova_config {
'oslo_messaging_rabbit/kombu_ssl_ca_certs': ensure => absent;
'oslo_messaging_rabbit/kombu_ssl_certfile': ensure => absent;
'oslo_messaging_rabbit/kombu_ssl_keyfile': ensure => absent;
'oslo_messaging_rabbit/kombu_ssl_version': ensure => absent;
}
}
if $rabbit_hosts {
nova_config { 'oslo_messaging_rabbit/rabbit_hosts': value => join($rabbit_hosts, ',') }
} else {
nova_config { 'oslo_messaging_rabbit/rabbit_host': value => $rabbit_host }
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 }
} else {
nova_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => false }
}
} else {
nova_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => $rabbit_ha_queues }
} }
} else {
nova_config { 'DEFAULT/rpc_backend': value => $rpc_backend }
} }
# we keep "nova.openstack.common.rpc.impl_qpid" for backward compatibility # we keep "nova.openstack.common.rpc.impl_qpid" for backward compatibility
@@ -657,7 +609,6 @@ class nova(
nova_config { nova_config {
'cinder/catalog_info': value => $cinder_catalog_info; 'cinder/catalog_info': value => $cinder_catalog_info;
'DEFAULT/rpc_backend': value => $rpc_backend;
'DEFAULT/notification_topics': value => $notification_topics; 'DEFAULT/notification_topics': value => $notification_topics;
'DEFAULT/notify_api_faults': value => $notify_api_faults; 'DEFAULT/notify_api_faults': value => $notify_api_faults;
# Following may need to be broken out to different nova services # Following may need to be broken out to different nova services

View File

@@ -40,6 +40,7 @@
{ "name": "openstack/keystone", "version_requirement": ">=8.0.0 <9.0.0" }, { "name": "openstack/keystone", "version_requirement": ">=8.0.0 <9.0.0" },
{ "name": "puppetlabs/rabbitmq", "version_requirement": ">=2.0.2 <6.0.0" }, { "name": "puppetlabs/rabbitmq", "version_requirement": ">=2.0.2 <6.0.0" },
{ "name": "puppetlabs/stdlib", "version_requirement": ">=4.0.0 <5.0.0" }, { "name": "puppetlabs/stdlib", "version_requirement": ">=4.0.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" }
] ]
} }

View File

@@ -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.

View File

@@ -43,13 +43,13 @@ describe 'nova' do
it 'configures rabbit' do it 'configures rabbit' do
is_expected.to contain_nova_config('DEFAULT/rpc_backend').with_value('rabbit') is_expected.to contain_nova_config('DEFAULT/rpc_backend').with_value('rabbit')
is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_host').with_value('localhost') is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_host').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_password').with_value('guest').with_secret(true) is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_password').with_value('<SERVICE DEFAULT>').with_secret(true)
is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_port').with_value('5672') is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_port').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_userid').with_value('guest') is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_userid').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value('/') is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('0') is_expected.to contain_nova_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('oslo_messaging_rabbit/heartbeat_rate').with_value('2') is_expected.to contain_nova_config('oslo_messaging_rabbit/heartbeat_rate').with_value('<SERVICE DEFAULT>')
end end
it 'configures various things' do it 'configures various things' do
@@ -83,11 +83,11 @@ describe 'nova' do
:debug => true, :debug => true,
:log_dir => '/var/log/nova2', :log_dir => '/var/log/nova2',
:image_service => 'nova.image.local.LocalImageService', :image_service => 'nova.image.local.LocalImageService',
:rpc_backend => 'rabbit',
:rabbit_host => 'rabbit', :rabbit_host => 'rabbit',
:rabbit_userid => 'rabbit_user', :rabbit_userid => 'rabbit_user',
:rabbit_port => '5673', :rabbit_port => '5673',
:rabbit_password => 'password', :rabbit_password => 'password',
:rabbit_ha_queues => 'undef',
:rabbit_heartbeat_timeout_threshold => '60', :rabbit_heartbeat_timeout_threshold => '60',
:rabbit_heartbeat_rate => '10', :rabbit_heartbeat_rate => '10',
:lock_path => '/var/locky/path', :lock_path => '/var/locky/path',
@@ -135,7 +135,7 @@ describe 'nova' do
is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_password').with_value('password').with_secret(true) is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_password').with_value('password').with_secret(true)
is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_port').with_value('5673') is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_port').with_value('5673')
is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_userid').with_value('rabbit_user') is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_userid').with_value('rabbit_user')
is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value('/') is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('60') is_expected.to contain_nova_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('60')
is_expected.to contain_nova_config('oslo_messaging_rabbit/heartbeat_rate').with_value('10') is_expected.to contain_nova_config('oslo_messaging_rabbit/heartbeat_rate').with_value('10')
end end
@@ -214,17 +214,18 @@ describe 'nova' do
end end
it 'configures rabbit' do it 'configures rabbit' do
is_expected.to_not contain_nova_config('oslo_messaging_rabbit/rabbit_host') is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_host').with_value('<SERVICE DEFAULT>')
is_expected.to_not contain_nova_config('oslo_messaging_rabbit/rabbit_port') is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_port').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_hosts').with_value('rabbit:5673,rabbit2:5674') is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_hosts').with_value('rabbit:5673,rabbit2:5674')
is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value(true) is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value(true)
is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value(false) is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('1.0') is_expected.to contain_nova_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('oslo_messaging_rabbit/amqp_durable_queues').with_value(false) is_expected.to contain_nova_config('oslo_messaging_rabbit/kombu_compression').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_ensure('absent') is_expected.to contain_nova_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_ensure('absent') is_expected.to contain_nova_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_ensure('absent') is_expected.to contain_nova_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('oslo_messaging_rabbit/kombu_ssl_version').with_ensure('absent') is_expected.to contain_nova_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('oslo_messaging_rabbit/kombu_ssl_version').with_value('<SERVICE DEFAULT>')
end end
end end
@@ -234,13 +235,13 @@ describe 'nova' do
end end
it 'configures rabbit' do it 'configures rabbit' do
is_expected.to_not contain_nova_config('oslo_messaging_rabbit/rabbit_host') is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_host').with_value('<SERVICE DEFAULT>')
is_expected.to_not contain_nova_config('oslo_messaging_rabbit/rabbit_port') is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_port').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_hosts').with_value('rabbit:5673') is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_hosts').with_value('rabbit:5673')
is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value(true) is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value(false) is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('1.0') is_expected.to contain_nova_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('oslo_messaging_rabbit/amqp_durable_queues').with_value(false) is_expected.to contain_nova_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('<SERVICE DEFAULT>')
end end
end end
@@ -256,7 +257,7 @@ describe 'nova' do
context 'with rabbit_ha_queues set to true' do context 'with rabbit_ha_queues set to true' do
let :params do let :params do
{ :rabbit_ha_queues => 'true' } { :rabbit_ha_queues => true }
end end
it 'configures rabbit' do it 'configures rabbit' do
@@ -278,27 +279,27 @@ describe 'nova' do
context 'with amqp_durable_queues parameter' do context 'with amqp_durable_queues parameter' do
let :params do let :params do
{ :rabbit_hosts => ['rabbit:5673'], { :rabbit_hosts => ['rabbit:5673'],
:amqp_durable_queues => 'true' } :amqp_durable_queues => true }
end end
it 'configures rabbit' do it 'configures rabbit' do
is_expected.to_not contain_nova_config('oslo_messaging_rabbit/rabbit_host') is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_host').with_value('<SERVICE DEFAULT>')
is_expected.to_not contain_nova_config('oslo_messaging_rabbit/rabbit_port') is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_port').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_hosts').with_value('rabbit:5673') is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_hosts').with_value('rabbit:5673')
is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value(true) is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value(false) is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('oslo_messaging_rabbit/amqp_durable_queues').with_value(true) is_expected.to contain_nova_config('oslo_messaging_rabbit/amqp_durable_queues').with_value(true)
is_expected.to contain_nova_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_ensure('absent') is_expected.to contain_nova_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_ensure('absent') is_expected.to contain_nova_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_ensure('absent') is_expected.to contain_nova_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('oslo_messaging_rabbit/kombu_ssl_version').with_ensure('absent') is_expected.to contain_nova_config('oslo_messaging_rabbit/kombu_ssl_version').with_value('<SERVICE DEFAULT>')
end end
end end
context 'with rabbit ssl enabled with kombu' do context 'with rabbit ssl enabled with kombu' do
let :params do let :params do
{ :rabbit_hosts => ['rabbit:5673'], { :rabbit_hosts => ['rabbit:5673'],
:rabbit_use_ssl => 'true', :rabbit_use_ssl => true,
:kombu_ssl_ca_certs => '/etc/ca.cert', :kombu_ssl_ca_certs => '/etc/ca.cert',
:kombu_ssl_certfile => '/etc/certfile', :kombu_ssl_certfile => '/etc/certfile',
:kombu_ssl_keyfile => '/etc/key', :kombu_ssl_keyfile => '/etc/key',
@@ -317,33 +318,15 @@ describe 'nova' do
context 'with rabbit ssl enabled without kombu' do context 'with rabbit ssl enabled without kombu' do
let :params do let :params do
{ :rabbit_hosts => ['rabbit:5673'], { :rabbit_hosts => ['rabbit:5673'],
:rabbit_use_ssl => 'true', } :rabbit_use_ssl => true, }
end end
it 'configures rabbit' do it 'configures rabbit' do
is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value(true) is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value(true)
is_expected.to contain_nova_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_ensure('absent') is_expected.to contain_nova_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_ensure('absent') is_expected.to contain_nova_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_ensure('absent') is_expected.to contain_nova_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('oslo_messaging_rabbit/kombu_ssl_version').with_value('TLSv1') is_expected.to contain_nova_config('oslo_messaging_rabbit/kombu_ssl_version').with_value('<SERVICE DEFAULT>')
end
end
context 'with rabbit ssl disabled' do
let :params do
{
:rabbit_password => 'pass',
:rabbit_use_ssl => false,
:kombu_ssl_version => 'TLSv1',
}
end
it 'configures rabbit' do
is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('false')
is_expected.to contain_nova_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_ensure('absent')
is_expected.to contain_nova_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_ensure('absent')
is_expected.to contain_nova_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_ensure('absent')
is_expected.to contain_nova_config('oslo_messaging_rabbit/kombu_ssl_version').with_ensure('absent')
end end
end end
@@ -352,7 +335,7 @@ describe 'nova' do
{ :rpc_backend => 'nova.openstack.common.rpc.impl_kombu' } { :rpc_backend => 'nova.openstack.common.rpc.impl_kombu' }
end end
it { is_expected.to contain_nova_config('DEFAULT/rpc_backend').with_value('nova.openstack.common.rpc.impl_kombu') } it { is_expected.to contain_nova_config('DEFAULT/rpc_backend').with_value('rabbit') }
end end
context 'with ssh public key' do context 'with ssh public key' do