Switch ironic to use puppet-oslo module

Messaging (rabbit), db and logging parameters
are configured using puppet-oslo module

Additional changes:

* switch messaging related parameters to
  $::os_service_default as they are used
  in oslo::messaging_rabbit define
* add rpc_response_timeout option as it is
  used in oslo module and needed by tripleo
* update unit tests

Depends-On: I1ccf3dc5c69733d0b1ae6eb5c22f8c80f1c89161
Change-Id: Ic9b302490dfab401f97808c63afabefed2e86199
This commit is contained in:
Mykyta Karpin 2016-04-13 17:10:04 +03:00
parent ff87e2519c
commit a632be23fd
8 changed files with 207 additions and 225 deletions

View File

@ -43,8 +43,6 @@ class ironic::db (
$database_max_overflow = $::os_service_default, $database_max_overflow = $::os_service_default,
) { ) {
include ::ironic::params
# NOTE(spredzy): In order to keep backward compatibility we rely on the pick function # NOTE(spredzy): In order to keep backward compatibility we rely on the pick function
# to use ironic::<myparam> if ironic::db::<myparam> isn't specified. # to use ironic::<myparam> if ironic::db::<myparam> isn't specified.
$database_connection_real = pick($::ironic::database_connection, $database_connection) $database_connection_real = pick($::ironic::database_connection, $database_connection)
@ -58,44 +56,14 @@ class ironic::db (
validate_re($database_connection_real, validate_re($database_connection_real,
'^(sqlite|mysql(\+pymysql)?|postgresql):\/\/(\S+:\S+@\S+\/\S+)?') '^(sqlite|mysql(\+pymysql)?|postgresql):\/\/(\S+:\S+@\S+\/\S+)?')
case $database_connection_real { oslo::db { 'ironic_config':
/^mysql(\+pymysql)?:\/\//: { connection => $database_connection_real,
require 'mysql::bindings' idle_timeout => $database_idle_timeout_real,
require 'mysql::bindings::python' min_pool_size => $database_min_pool_size_real,
if $database_connection_real =~ /^mysql\+pymysql/ { max_pool_size => $database_max_pool_size_real,
$backend_package = $::ironic::params::pymysql_package_name max_retries => $database_max_retries_real,
} else { retry_interval => $database_retry_interval_real,
$backend_package = false max_overflow => $database_max_overflow_real,
}
}
/^postgresql:\/\//: {
$backend_package = false
require 'postgresql::lib::python'
}
/^sqlite:\/\//: {
$backend_package = $::ironic::params::sqlite_package_name
}
default: {
fail('Unsupported backend configured')
}
}
if $backend_package and !defined(Package[$backend_package]) {
package {'ironic-backend-package':
ensure => present,
name => $backend_package,
tag => 'openstack',
}
}
ironic_config {
'database/connection': value => $database_connection_real, secret => true;
'database/idle_timeout': value => $database_idle_timeout_real;
'database/max_retries': value => $database_max_retries_real;
'database/retry_interval': value => $database_retry_interval_real;
'database/min_pool_size': value => $database_min_pool_size_real;
'database/max_pool_size': value => $database_max_pool_size_real;
'database/max_overflow': value => $database_max_overflow_real;
} }
} }

View File

@ -46,69 +46,103 @@
# initialization. # initialization.
# Defaults to ['pxe_ipmitool']. # Defaults to ['pxe_ipmitool'].
# #
# [*rpc_response_timeout*]
# (optional) Seconds to wait for a response from a call. (integer value)
# Defaults to $::os_service_default.
#
# [*control_exchange*] # [*control_exchange*]
# (optional) What RPC queue/exchange to use # (optional) What RPC queue/exchange to use (string value)
# Defaults to openstack # Defaults to $::os_service_default
# #
# [*rpc_backend*] # [*rpc_backend*]
# (optional) what rpc/queuing service to use # (optional) what rpc/queuing service to use (string value)
# Defaults to rabbit (rabbitmq) # Defaults to $::os_service_default
# #
# [*rabbit_host*] # [*rabbit_host*]
# (Optional) IP or hostname of the rabbit server. # (optional) IP or hostname of the rabbit server. (string value)
# Defaults to 'localhost' # Defaults to $::os_service_default
#
# [*rabbit_port*]
# (Optional) Port of the rabbit server.
# Defaults to 5672.
# #
# [*rabbit_hosts*] # [*rabbit_hosts*]
# (Optional) Array of host:port (used with HA queues). # (optional) List of clustered rabbit servers. (string value)
# If defined, will remove rabbit_host & rabbit_port parameters from config # Defaults to $::os_service_default
# Defaults to undef.
# #
# [*rabbit_user*] # [*rabbit_user*]
# (Optional) User to connect to the rabbit server. # (optional) User to connect to the rabbit server.
# Defaults to undef. # Defaults to undef.
# Deprecated, use rabbit_userid instead. # Deprecated, use rabbit_userid instead.
# #
# [*rabbit_userid*] # [*rabbit_userid*]
# (Optional) User to connect to the rabbit server. # (optional) User used to connect to rabbitmq. (string value)
# Defaults to 'guest' # Defaults to $::os_service_default
#
# [*rabbit_port*]
# (optional) Port for rabbitmq instance. (port value)
# Defaults to $::os_service_default
# #
# [*rabbit_password*] # [*rabbit_password*]
# (Optional) Password to connect to the rabbit_server. # (optional) Password used to connect to rabbitmq. (string value)
# Defaults to empty. # Defaults to $::os_service_default
# #
# [*rabbit_virtual_host*] # [*rabbit_virtual_host*]
# (Optional) Virtual_host to use. # (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) Connect over SSL for RabbitMQ. (boolean value)
# Defaults to false # Defaults to $::os_service_default
#
# [*rabbit_ha_queues*]
# (optional) Use HA queues in RabbitMQ. (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. (integer value)
# Defaults to $::os_service_default
#
# [*rabbit_heartbeat_rate*]
# (optional) How often during the rabbit_heartbeat_timeout_threshold period
# to check the heartbeat on RabbitMQ connection.
# i.e. rabbit_heartbeat_rate=2 when rabbit_heartbeat_timeout_threshold=60,
# the heartbeat will be checked every 30 seconds. (integer value)
# 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*]
# (optional) How long to wait before reconnecting in response to an AMQP
# consumer cancel notification. (floating point 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
# #
# [*amqp_durable_queues*] # [*amqp_durable_queues*]
# Use durable queues in amqp. # (optional) Define queues as "durable" to rabbitmq. (boolean value)
# (Optional) Defaults to false. # Defaults to $::os_service_default
# #
# [*use_syslog*] # [*use_syslog*]
# (optional) Use syslog for logging # (optional) Use syslog for logging
@ -187,20 +221,26 @@ class ironic (
$log_dir = undef, $log_dir = undef,
$auth_strategy = 'keystone', $auth_strategy = 'keystone',
$enabled_drivers = ['pxe_ipmitool'], $enabled_drivers = ['pxe_ipmitool'],
$control_exchange = 'openstack', $control_exchange = $::os_service_default,
$rpc_backend = 'rabbit', $rpc_response_timeout = $::os_service_default,
$rabbit_hosts = false, $rpc_backend = $::os_service_default,
$rabbit_virtual_host = '/', $rabbit_host = $::os_service_default,
$rabbit_host = 'localhost', $rabbit_hosts = $::os_service_default,
$rabbit_port = 5672, $rabbit_password = $::os_service_default,
$rabbit_userid = 'guest', $rabbit_port = $::os_service_default,
$rabbit_password = false, $rabbit_userid = $::os_service_default,
$rabbit_use_ssl = false, $rabbit_virtual_host = $::os_service_default,
$kombu_ssl_ca_certs = undef, $rabbit_use_ssl = $::os_service_default,
$kombu_ssl_certfile = undef, $rabbit_heartbeat_timeout_threshold = $::os_service_default,
$kombu_ssl_keyfile = undef, $rabbit_heartbeat_rate = $::os_service_default,
$kombu_ssl_version = 'TLSv1', $rabbit_ha_queues = $::os_service_default,
$amqp_durable_queues = false, $kombu_ssl_ca_certs = $::os_service_default,
$kombu_ssl_certfile = $::os_service_default,
$kombu_ssl_keyfile = $::os_service_default,
$kombu_ssl_version = $::os_service_default,
$kombu_reconnect_delay = $::os_service_default,
$kombu_compression = $::os_service_default,
$amqp_durable_queues = $::os_service_default,
$database_connection = undef, $database_connection = undef,
$database_max_retries = undef, $database_max_retries = undef,
$database_idle_timeout = undef, $database_idle_timeout = undef,
@ -270,7 +310,6 @@ class ironic (
ironic_config { ironic_config {
'DEFAULT/auth_strategy': value => $auth_strategy; 'DEFAULT/auth_strategy': value => $auth_strategy;
'DEFAULT/rpc_backend': value => $rpc_backend;
'DEFAULT/enabled_drivers': value => join($enabled_drivers, ','); 'DEFAULT/enabled_drivers': value => join($enabled_drivers, ',');
'glance/glance_num_retries': value => $glance_num_retries; 'glance/glance_num_retries': value => $glance_num_retries;
'glance/glance_api_insecure': value => $glance_api_insecure; 'glance/glance_api_insecure': value => $glance_api_insecure;
@ -280,61 +319,33 @@ class ironic (
include ::ironic::db::sync include ::ironic::db::sync
} }
if $rpc_backend == 'ironic.openstack.common.rpc.impl_kombu' or $rpc_backend == 'rabbit' { oslo::messaging::default {'ironic_config':
rpc_response_timeout => $rpc_response_timeout,
if ! $rabbit_password { control_exchange => $control_exchange,
fail('When rpc_backend is rabbitmq, you must set rabbit password')
} }
ironic_config { if $rpc_backend in [$::os_service_default, 'ironic.openstack.common.rpc.impl_kombu', 'rabbit'] {
'oslo_messaging_rabbit/rabbit_userid': value => $rabbit_user_real; oslo::messaging::rabbit {'ironic_config':
'oslo_messaging_rabbit/rabbit_password': value => $rabbit_password, secret => true; rabbit_password => $rabbit_password,
'oslo_messaging_rabbit/rabbit_virtual_host': value => $rabbit_virtual_host; rabbit_userid => $rabbit_user_real,
'oslo_messaging_rabbit/rabbit_use_ssl': value => $rabbit_use_ssl; rabbit_virtual_host => $rabbit_virtual_host,
'DEFAULT/control_exchange': value => $control_exchange; rabbit_use_ssl => $rabbit_use_ssl,
'oslo_messaging_rabbit/amqp_durable_queues': value => $amqp_durable_queues; heartbeat_timeout_threshold => $rabbit_heartbeat_timeout_threshold,
} heartbeat_rate => $rabbit_heartbeat_rate,
kombu_reconnect_delay => $kombu_reconnect_delay,
if $rabbit_hosts { amqp_durable_queues => $amqp_durable_queues,
ironic_config { 'oslo_messaging_rabbit/rabbit_hosts': value => join($rabbit_hosts, ',') } kombu_compression => $kombu_compression,
ironic_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => true } kombu_ssl_ca_certs => $kombu_ssl_ca_certs,
ironic_config { 'oslo_messaging_rabbit/rabbit_host': ensure => absent } kombu_ssl_certfile => $kombu_ssl_certfile,
ironic_config { 'oslo_messaging_rabbit/rabbit_port': ensure => absent } kombu_ssl_keyfile => $kombu_ssl_keyfile,
} else { kombu_ssl_version => $kombu_ssl_version,
ironic_config { 'oslo_messaging_rabbit/rabbit_host': value => $rabbit_host } rabbit_hosts => $rabbit_hosts,
ironic_config { 'oslo_messaging_rabbit/rabbit_port': value => $rabbit_port } rabbit_host => $rabbit_host,
ironic_config { 'oslo_messaging_rabbit/rabbit_hosts': value => "${rabbit_host}:${rabbit_port}" } rabbit_port => $rabbit_port,
ironic_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => false } rabbit_ha_queues => $rabbit_ha_queues,
}
if $rabbit_use_ssl {
ironic_config { 'oslo_messaging_rabbit/kombu_ssl_version': value => $kombu_ssl_version }
if $kombu_ssl_ca_certs {
ironic_config { 'oslo_messaging_rabbit/kombu_ssl_ca_certs': value => $kombu_ssl_ca_certs }
} else {
ironic_config { 'oslo_messaging_rabbit/kombu_ssl_ca_certs': ensure => absent}
}
if $kombu_ssl_certfile {
ironic_config { 'oslo_messaging_rabbit/kombu_ssl_certfile': value => $kombu_ssl_certfile }
} else {
ironic_config { 'oslo_messaging_rabbit/kombu_ssl_certfile': ensure => absent}
}
if $kombu_ssl_keyfile {
ironic_config { 'oslo_messaging_rabbit/kombu_ssl_keyfile': value => $kombu_ssl_keyfile }
} else {
ironic_config { 'oslo_messaging_rabbit/kombu_ssl_keyfile': ensure => absent}
} }
} else { } else {
ironic_config { ironic_config { 'DEFAULT/rpc_backend': value => $rpc_backend }
'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;
}
}
} }
} }

View File

@ -118,31 +118,24 @@ class ironic::logging(
$verbose_real = pick($::ironic::verbose,$verbose) $verbose_real = pick($::ironic::verbose,$verbose)
$debug_real = pick($::ironic::debug,$debug) $debug_real = pick($::ironic::debug,$debug)
if is_service_default($default_log_levels) { oslo::log { 'ironic_config':
$default_log_levels_real = $default_log_levels debug => $debug_real,
} else { verbose => $verbose_real,
$default_log_levels_real = join(sort(join_keys_to_values($default_log_levels, '=')), ',') use_stderr => $use_stderr_real,
use_syslog => $use_syslog_real,
log_dir => $log_dir_real,
syslog_log_facility => $log_facility_real,
logging_context_format_string => $logging_context_format_string,
logging_default_format_string => $logging_default_format_string,
logging_debug_format_suffix => $logging_debug_format_suffix,
logging_exception_prefix => $logging_exception_prefix,
log_config_append => $log_config_append,
default_log_levels => $default_log_levels,
publish_errors => $publish_errors,
fatal_deprecations => $fatal_deprecations,
instance_format => $instance_format,
instance_uuid_format => $instance_uuid_format,
log_date_format => $log_date_format,
} }
ironic_config {
'DEFAULT/debug': value => $debug_real;
'DEFAULT/verbose': value => $verbose_real;
'DEFAULT/use_stderr': value => $use_stderr_real;
'DEFAULT/use_syslog': value => $use_syslog_real;
'DEFAULT/log_dir': value => $log_dir_real;
'DEFAULT/syslog_log_facility': value => $log_facility_real;
'DEFAULT/logging_context_format_string': value => $logging_context_format_string;
'DEFAULT/logging_default_format_string': value => $logging_default_format_string;
'DEFAULT/logging_debug_format_suffix': value => $logging_debug_format_suffix;
'DEFAULT/logging_exception_prefix': value => $logging_exception_prefix;
'DEFAULT/log_config_append': value => $log_config_append;
'DEFAULT/default_log_levels': value => $default_log_levels_real;
'DEFAULT/publish_errors': value => $publish_errors;
'DEFAULT/fatal_deprecations': value => $fatal_deprecations;
'DEFAULT/instance_format': value => $instance_format;
'DEFAULT/instance_uuid_format': value => $instance_uuid_format;
'DEFAULT/log_date_format': value => $log_date_format;
}
} }

View File

@ -37,8 +37,6 @@ class ironic::params {
$inspector_package = 'openstack-ironic-inspector' $inspector_package = 'openstack-ironic-inspector'
$inspector_service = 'openstack-ironic-inspector' $inspector_service = 'openstack-ironic-inspector'
$inspector_dnsmasq_service = 'openstack-ironic-inspector-dnsmasq' $inspector_dnsmasq_service = 'openstack-ironic-inspector-dnsmasq'
$sqlite_package_name = undef
$pymysql_package_name = undef
$ipxe_rom_dir = '/usr/share/ipxe' $ipxe_rom_dir = '/usr/share/ipxe'
$ironic_wsgi_script_path = '/var/www/cgi-bin/ironic' $ironic_wsgi_script_path = '/var/www/cgi-bin/ironic'
$ironic_wsgi_script_source = '/usr/lib/python2.7/site-packages/ironic/api/app.wsgi' $ironic_wsgi_script_source = '/usr/lib/python2.7/site-packages/ironic/api/app.wsgi'
@ -56,8 +54,6 @@ class ironic::params {
# https://packages.debian.org/source/experimental/ironic-inspector # https://packages.debian.org/source/experimental/ironic-inspector
# this should be changed to whatever debian will use for dnsmasq # this should be changed to whatever debian will use for dnsmasq
$inspector_dnsmasq_service = 'ironic-inspector-dnsmasq' $inspector_dnsmasq_service = 'ironic-inspector-dnsmasq'
$sqlite_package_name = 'python-pysqlite2'
$pymysql_package_name = 'python-pymysql'
$ipxe_rom_dir = '/usr/lib/ipxe' $ipxe_rom_dir = '/usr/lib/ipxe'
$ironic_wsgi_script_path = '/usr/lib/cgi-bin/ironic' $ironic_wsgi_script_path = '/usr/lib/cgi-bin/ironic'
$ironic_wsgi_script_source = '/usr/lib/python2.7/dist-packages/ironic/api/app.wsgi' $ironic_wsgi_script_source = '/usr/lib/python2.7/dist-packages/ironic/api/app.wsgi'

View File

@ -35,6 +35,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/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": "puppetlabs/vcsrepo", "version_requirement": ">=1.3.0 <2.0.0"} { "name": "puppetlabs/vcsrepo", "version_requirement": ">=1.3.0 <2.0.0"},
{ "name": "openstack/oslo", "version_requirement": "<9.0.0" }
] ]
} }

View File

@ -0,0 +1,5 @@
---
features:
- Use oslo module for messaging (rabbit), db and logging configuration.
Messaging related parameters were switched to $::os_service_default.
Docs string for parameter were updated according to oslo module.

View File

@ -89,10 +89,31 @@ describe 'ironic::db' do
{ :database_connection => 'mysql+pymysql://ironic:ironic@localhost/ironic' } { :database_connection => 'mysql+pymysql://ironic:ironic@localhost/ironic' }
end end
it { is_expected.to contain_package('ironic-backend-package').with({ :ensure => 'present', :name => 'python-pymysql' }) } it 'install the proper backend package' do
is_expected.to contain_package('db_backend_package').with(
:ensure => 'present',
:name => 'python-pymysql',
:tag => ['openstack'],
)
end end
end end
context 'with sqlite backend' do
let :params do
{ :database_connection => 'sqlite:///var/lib/nova/nova.sqlite', }
end
it 'install the proper backend package' do
is_expected.to contain_package('db_backend_package').with(
:ensure => 'present',
:name => 'python-pysqlite2',
:tag => ['openstack'],
)
end
end
end
context 'on Redhat platforms' do context 'on Redhat platforms' do
let :facts do let :facts do
@default_facts.merge({ :osfamily => 'RedHat', @default_facts.merge({ :osfamily => 'RedHat',
@ -107,7 +128,7 @@ describe 'ironic::db' do
{ :database_connection => 'mysql+pymysql://ironic:ironic@localhost/ironic' } { :database_connection => 'mysql+pymysql://ironic:ironic@localhost/ironic' }
end end
it { is_expected.not_to contain_package('ironic-backend-package') } it { is_expected.not_to contain_package('db_backend_package') }
end end
end end

View File

@ -27,12 +27,6 @@ describe 'ironic' do
:verbose => false, :verbose => false,
:debug => false, :debug => false,
:enabled_drivers => ['pxe_ipmitool'], :enabled_drivers => ['pxe_ipmitool'],
:rabbit_host => '127.0.0.1',
:rabbit_port => 5672,
:rabbit_hosts => false,
:rabbit_userid => 'guest',
:rabbit_password => 'guest',
:rabbit_virtual_host => '/',
:database_connection => 'sqlite:////var/lib/ironic/ironic.sqlite', :database_connection => 'sqlite:////var/lib/ironic/ironic.sqlite',
:database_max_retries => 10, :database_max_retries => 10,
:database_idle_timeout => 3600, :database_idle_timeout => 3600,
@ -57,10 +51,6 @@ describe 'ironic' do
end end
context 'and if rabbit_hosts parameter is provided' do context 'and if rabbit_hosts parameter is provided' do
before do
params.delete(:rabbit_host)
params.delete(:rabbit_port)
end
context 'with one server' do context 'with one server' do
before { params.merge!( :rabbit_hosts => ['127.0.0.1:5672'] ) } before { params.merge!( :rabbit_hosts => ['127.0.0.1:5672'] ) }
@ -110,9 +100,9 @@ describe 'ironic' do
end end
it 'configures credentials for rabbit' do it 'configures credentials for rabbit' do
is_expected.to contain_ironic_config('oslo_messaging_rabbit/rabbit_userid').with_value( params[:rabbit_userid] ) is_expected.to contain_ironic_config('oslo_messaging_rabbit/rabbit_userid').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('oslo_messaging_rabbit/rabbit_password').with_value( params[:rabbit_password] ) is_expected.to contain_ironic_config('oslo_messaging_rabbit/rabbit_password').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value( params[:rabbit_virtual_host] ) is_expected.to contain_ironic_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('oslo_messaging_rabbit/rabbit_password').with_secret( true ) is_expected.to contain_ironic_config('oslo_messaging_rabbit/rabbit_password').with_secret( true )
end end
@ -130,23 +120,24 @@ describe 'ironic' do
it 'configures ironic.conf' do it 'configures ironic.conf' do
is_expected.to contain_ironic_config('DEFAULT/auth_strategy').with_value('keystone') is_expected.to contain_ironic_config('DEFAULT/auth_strategy').with_value('keystone')
is_expected.to contain_ironic_config('DEFAULT/control_exchange').with_value('openstack') is_expected.to contain_ironic_config('DEFAULT/rpc_response_timeout').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('DEFAULT/control_exchange').with_value('<SERVICE DEFAULT>')
end end
end end
shared_examples_for 'rabbit HA with a single virtual host' do shared_examples_for 'rabbit HA with a single virtual host' do
it 'in ironic.conf' do it 'in ironic.conf' do
is_expected.to contain_ironic_config('oslo_messaging_rabbit/rabbit_host').with_ensure('absent') is_expected.to contain_ironic_config('oslo_messaging_rabbit/rabbit_host').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('oslo_messaging_rabbit/rabbit_port').with_ensure('absent') is_expected.to contain_ironic_config('oslo_messaging_rabbit/rabbit_port').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('oslo_messaging_rabbit/rabbit_hosts').with_value( params[:rabbit_hosts] ) is_expected.to contain_ironic_config('oslo_messaging_rabbit/rabbit_hosts').with_value( params[:rabbit_hosts] )
is_expected.to contain_ironic_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value(true) is_expected.to contain_ironic_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('<SERVICE DEFAULT>')
end end
end end
shared_examples_for 'rabbit HA with multiple hosts' do shared_examples_for 'rabbit HA with multiple hosts' do
it 'in ironic.conf' do it 'in ironic.conf' do
is_expected.to contain_ironic_config('oslo_messaging_rabbit/rabbit_host').with_ensure('absent') is_expected.to contain_ironic_config('oslo_messaging_rabbit/rabbit_host').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('oslo_messaging_rabbit/rabbit_port').with_ensure('absent') is_expected.to contain_ironic_config('oslo_messaging_rabbit/rabbit_port').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('oslo_messaging_rabbit/rabbit_hosts').with_value( params[:rabbit_hosts].join(',') ) is_expected.to contain_ironic_config('oslo_messaging_rabbit/rabbit_hosts').with_value( params[:rabbit_hosts].join(',') )
is_expected.to contain_ironic_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value(true) is_expected.to contain_ironic_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value(true)
end end
@ -181,10 +172,10 @@ describe 'ironic' do
it do it do
is_expected.to contain_ironic_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('true') is_expected.to contain_ironic_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('true')
is_expected.to contain_ironic_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_ensure('absent') is_expected.to contain_ironic_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_ensure('absent') is_expected.to contain_ironic_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_ensure('absent') is_expected.to contain_ironic_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('oslo_messaging_rabbit/kombu_ssl_version').with_value('TLSv1') is_expected.to contain_ironic_config('oslo_messaging_rabbit/kombu_ssl_version').with_value('<SERVICE DEFAULT>')
end end
end end
@ -192,25 +183,21 @@ describe 'ironic' do
before do before do
params.merge!( params.merge!(
:rabbit_use_ssl => false, :rabbit_use_ssl => false,
:kombu_ssl_ca_certs => 'undef',
:kombu_ssl_certfile => 'undef',
:kombu_ssl_keyfile => 'undef',
:kombu_ssl_version => 'TLSv1'
) )
end end
it do it do
is_expected.to contain_ironic_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('false') is_expected.to contain_ironic_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('false')
is_expected.to contain_ironic_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_ensure('absent') is_expected.to contain_ironic_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_ensure('absent') is_expected.to contain_ironic_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_ensure('absent') is_expected.to contain_ironic_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('oslo_messaging_rabbit/kombu_ssl_version').with_ensure('absent') is_expected.to contain_ironic_config('oslo_messaging_rabbit/kombu_ssl_version').with_value('<SERVICE DEFAULT>')
end end
end end
shared_examples_for 'with amqp_durable_queues disabled' do shared_examples_for 'with amqp_durable_queues disabled' do
it { is_expected.to contain_ironic_config('oslo_messaging_rabbit/amqp_durable_queues').with_value(false) } it { is_expected.to contain_ironic_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('<SERVICE DEFAULT>') }
end end
shared_examples_for 'with amqp_durable_queues enabled' do shared_examples_for 'with amqp_durable_queues enabled' do