From a632be23fdca526e88b2508eb722a94025244206 Mon Sep 17 00:00:00 2001 From: Mykyta Karpin Date: Wed, 13 Apr 2016 17:10:04 +0300 Subject: [PATCH] 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 --- manifests/db.pp | 48 +--- manifests/init.pp | 253 +++++++++--------- manifests/logging.pp | 43 ++- manifests/params.pp | 4 - metadata.json | 3 +- ...ch_to_oslo_messaging-3dabb3d90892b881.yaml | 5 + spec/classes/ironic_db_spec.rb | 25 +- spec/classes/ironic_init_spec.rb | 51 ++-- 8 files changed, 207 insertions(+), 225 deletions(-) create mode 100644 releasenotes/notes/switch_to_oslo_messaging-3dabb3d90892b881.yaml diff --git a/manifests/db.pp b/manifests/db.pp index 43a266f6..64951101 100644 --- a/manifests/db.pp +++ b/manifests/db.pp @@ -43,8 +43,6 @@ class ironic::db ( $database_max_overflow = $::os_service_default, ) { - include ::ironic::params - # NOTE(spredzy): In order to keep backward compatibility we rely on the pick function # to use ironic:: if ironic::db:: isn't specified. $database_connection_real = pick($::ironic::database_connection, $database_connection) @@ -58,44 +56,14 @@ class ironic::db ( validate_re($database_connection_real, '^(sqlite|mysql(\+pymysql)?|postgresql):\/\/(\S+:\S+@\S+\/\S+)?') - case $database_connection_real { - /^mysql(\+pymysql)?:\/\//: { - require 'mysql::bindings' - require 'mysql::bindings::python' - if $database_connection_real =~ /^mysql\+pymysql/ { - $backend_package = $::ironic::params::pymysql_package_name - } else { - $backend_package = false - } - } - /^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; + oslo::db { 'ironic_config': + connection => $database_connection_real, + idle_timeout => $database_idle_timeout_real, + min_pool_size => $database_min_pool_size_real, + max_pool_size => $database_max_pool_size_real, + max_retries => $database_max_retries_real, + retry_interval => $database_retry_interval_real, + max_overflow => $database_max_overflow_real, } } diff --git a/manifests/init.pp b/manifests/init.pp index 5aedcd3e..10754284 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -46,69 +46,103 @@ # initialization. # 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*] -# (optional) What RPC queue/exchange to use -# Defaults to openstack +# (optional) What RPC queue/exchange to use (string value) +# Defaults to $::os_service_default # # [*rpc_backend*] -# (optional) what rpc/queuing service to use -# Defaults to rabbit (rabbitmq) +# (optional) what rpc/queuing service to use (string value) +# Defaults to $::os_service_default # # [*rabbit_host*] -# (Optional) IP or hostname of the rabbit server. -# Defaults to 'localhost' -# -# [*rabbit_port*] -# (Optional) Port of the rabbit server. -# Defaults to 5672. +# (optional) IP or hostname of the rabbit server. (string value) +# Defaults to $::os_service_default # # [*rabbit_hosts*] -# (Optional) Array of host:port (used with HA queues). -# If defined, will remove rabbit_host & rabbit_port parameters from config -# Defaults to undef. +# (optional) List of clustered rabbit servers. (string value) +# Defaults to $::os_service_default # # [*rabbit_user*] -# (Optional) User to connect to the rabbit server. +# (optional) User to connect to the rabbit server. # Defaults to undef. # Deprecated, use rabbit_userid instead. # # [*rabbit_userid*] -# (Optional) User to connect to the rabbit server. -# Defaults to 'guest' +# (optional) User used to connect to rabbitmq. (string value) +# Defaults to $::os_service_default +# +# [*rabbit_port*] +# (optional) Port for rabbitmq instance. (port value) +# Defaults to $::os_service_default # # [*rabbit_password*] -# (Optional) Password to connect to the rabbit_server. -# Defaults to empty. +# (optional) Password used to connect to rabbitmq. (string value) +# Defaults to $::os_service_default # # [*rabbit_virtual_host*] -# (Optional) Virtual_host to use. -# Defaults to '/' +# (optional) The RabbitMQ virtual host. (string value) +# Defaults to $::os_service_default # # [*rabbit_use_ssl*] -# (optional) Connect over SSL for RabbitMQ -# Defaults to false +# (optional) Connect over SSL for RabbitMQ. (boolean value) +# 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*] # (optional) SSL certification authority file (valid only if SSL enabled). -# Defaults to undef +# (string value) +# Defaults to $::os_service_default # # [*kombu_ssl_certfile*] -# (optional) SSL cert file (valid only if SSL enabled). -# Defaults to undef +# (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 undef +# (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 'TLSv1' +# 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. (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*] -# Use durable queues in amqp. -# (Optional) Defaults to false. +# (optional) Define queues as "durable" to rabbitmq. (boolean value) +# Defaults to $::os_service_default # # [*use_syslog*] # (optional) Use syslog for logging @@ -177,42 +211,48 @@ # Defaults to true # class ironic ( - $enabled = true, - $package_ensure = 'present', - $verbose = undef, - $debug = undef, - $use_syslog = undef, - $use_stderr = undef, - $log_facility = undef, - $log_dir = undef, - $auth_strategy = 'keystone', - $enabled_drivers = ['pxe_ipmitool'], - $control_exchange = 'openstack', - $rpc_backend = 'rabbit', - $rabbit_hosts = false, - $rabbit_virtual_host = '/', - $rabbit_host = 'localhost', - $rabbit_port = 5672, - $rabbit_userid = 'guest', - $rabbit_password = false, - $rabbit_use_ssl = false, - $kombu_ssl_ca_certs = undef, - $kombu_ssl_certfile = undef, - $kombu_ssl_keyfile = undef, - $kombu_ssl_version = 'TLSv1', - $amqp_durable_queues = false, - $database_connection = undef, - $database_max_retries = undef, - $database_idle_timeout = undef, - $database_reconnect_interval = undef, - $database_retry_interval = undef, - $database_min_pool_size = undef, - $database_max_pool_size = undef, - $database_max_overflow = undef, - $glance_api_servers = undef, - $glance_num_retries = '0', - $glance_api_insecure = false, - $sync_db = true, + $enabled = true, + $package_ensure = 'present', + $verbose = undef, + $debug = undef, + $use_syslog = undef, + $use_stderr = undef, + $log_facility = undef, + $log_dir = undef, + $auth_strategy = 'keystone', + $enabled_drivers = ['pxe_ipmitool'], + $control_exchange = $::os_service_default, + $rpc_response_timeout = $::os_service_default, + $rpc_backend = $::os_service_default, + $rabbit_host = $::os_service_default, + $rabbit_hosts = $::os_service_default, + $rabbit_password = $::os_service_default, + $rabbit_port = $::os_service_default, + $rabbit_userid = $::os_service_default, + $rabbit_virtual_host = $::os_service_default, + $rabbit_use_ssl = $::os_service_default, + $rabbit_heartbeat_timeout_threshold = $::os_service_default, + $rabbit_heartbeat_rate = $::os_service_default, + $rabbit_ha_queues = $::os_service_default, + $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_max_retries = undef, + $database_idle_timeout = undef, + $database_reconnect_interval = undef, + $database_retry_interval = undef, + $database_min_pool_size = undef, + $database_max_pool_size = undef, + $database_max_overflow = undef, + $glance_api_servers = undef, + $glance_num_retries = '0', + $glance_api_insecure = false, + $sync_db = true, # DEPRECATED PARAMETERS $rabbit_user = undef, ) { @@ -270,7 +310,6 @@ class ironic ( ironic_config { 'DEFAULT/auth_strategy': value => $auth_strategy; - 'DEFAULT/rpc_backend': value => $rpc_backend; 'DEFAULT/enabled_drivers': value => join($enabled_drivers, ','); 'glance/glance_num_retries': value => $glance_num_retries; 'glance/glance_api_insecure': value => $glance_api_insecure; @@ -280,61 +319,33 @@ class ironic ( 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, + control_exchange => $control_exchange, + } - if ! $rabbit_password { - fail('When rpc_backend is rabbitmq, you must set rabbit password') - } - - ironic_config { - 'oslo_messaging_rabbit/rabbit_userid': value => $rabbit_user_real; - 'oslo_messaging_rabbit/rabbit_password': value => $rabbit_password, secret => true; - 'oslo_messaging_rabbit/rabbit_virtual_host': value => $rabbit_virtual_host; - 'oslo_messaging_rabbit/rabbit_use_ssl': value => $rabbit_use_ssl; - 'DEFAULT/control_exchange': value => $control_exchange; - 'oslo_messaging_rabbit/amqp_durable_queues': value => $amqp_durable_queues; - } - - if $rabbit_hosts { - ironic_config { 'oslo_messaging_rabbit/rabbit_hosts': value => join($rabbit_hosts, ',') } - ironic_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => true } - ironic_config { 'oslo_messaging_rabbit/rabbit_host': ensure => absent } - ironic_config { 'oslo_messaging_rabbit/rabbit_port': ensure => absent } - } else { - ironic_config { 'oslo_messaging_rabbit/rabbit_host': value => $rabbit_host } - ironic_config { 'oslo_messaging_rabbit/rabbit_port': value => $rabbit_port } - ironic_config { 'oslo_messaging_rabbit/rabbit_hosts': value => "${rabbit_host}:${rabbit_port}" } - ironic_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => false } - } - - 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 { - ironic_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 $rpc_backend in [$::os_service_default, 'ironic.openstack.common.rpc.impl_kombu', 'rabbit'] { + oslo::messaging::rabbit {'ironic_config': + rabbit_password => $rabbit_password, + rabbit_userid => $rabbit_user_real, + rabbit_virtual_host => $rabbit_virtual_host, + rabbit_use_ssl => $rabbit_use_ssl, + heartbeat_timeout_threshold => $rabbit_heartbeat_timeout_threshold, + heartbeat_rate => $rabbit_heartbeat_rate, + kombu_reconnect_delay => $kombu_reconnect_delay, + amqp_durable_queues => $amqp_durable_queues, + kombu_compression => $kombu_compression, + 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, + rabbit_hosts => $rabbit_hosts, + rabbit_host => $rabbit_host, + rabbit_port => $rabbit_port, + rabbit_ha_queues => $rabbit_ha_queues, } + } else { + ironic_config { 'DEFAULT/rpc_backend': value => $rpc_backend } } } diff --git a/manifests/logging.pp b/manifests/logging.pp index c41f6b74..212108ae 100644 --- a/manifests/logging.pp +++ b/manifests/logging.pp @@ -118,31 +118,24 @@ class ironic::logging( $verbose_real = pick($::ironic::verbose,$verbose) $debug_real = pick($::ironic::debug,$debug) - if is_service_default($default_log_levels) { - $default_log_levels_real = $default_log_levels - } else { - $default_log_levels_real = join(sort(join_keys_to_values($default_log_levels, '=')), ',') + oslo::log { 'ironic_config': + debug => $debug_real, + verbose => $verbose_real, + 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; - } - - } diff --git a/manifests/params.pp b/manifests/params.pp index 6b875586..0e8f7b50 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -37,8 +37,6 @@ class ironic::params { $inspector_package = 'openstack-ironic-inspector' $inspector_service = 'openstack-ironic-inspector' $inspector_dnsmasq_service = 'openstack-ironic-inspector-dnsmasq' - $sqlite_package_name = undef - $pymysql_package_name = undef $ipxe_rom_dir = '/usr/share/ipxe' $ironic_wsgi_script_path = '/var/www/cgi-bin/ironic' $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 # this should be changed to whatever debian will use for dnsmasq $inspector_dnsmasq_service = 'ironic-inspector-dnsmasq' - $sqlite_package_name = 'python-pysqlite2' - $pymysql_package_name = 'python-pymysql' $ipxe_rom_dir = '/usr/lib/ipxe' $ironic_wsgi_script_path = '/usr/lib/cgi-bin/ironic' $ironic_wsgi_script_source = '/usr/lib/python2.7/dist-packages/ironic/api/app.wsgi' diff --git a/metadata.json b/metadata.json index 5916c367..3313873b 100644 --- a/metadata.json +++ b/metadata.json @@ -35,6 +35,7 @@ { "name": "openstack/keystone", "version_requirement": ">=8.0.0 <9.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": "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" } ] } diff --git a/releasenotes/notes/switch_to_oslo_messaging-3dabb3d90892b881.yaml b/releasenotes/notes/switch_to_oslo_messaging-3dabb3d90892b881.yaml new file mode 100644 index 00000000..b2eed8a2 --- /dev/null +++ b/releasenotes/notes/switch_to_oslo_messaging-3dabb3d90892b881.yaml @@ -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. diff --git a/spec/classes/ironic_db_spec.rb b/spec/classes/ironic_db_spec.rb index e2667a62..b4bbf6b8 100644 --- a/spec/classes/ironic_db_spec.rb +++ b/spec/classes/ironic_db_spec.rb @@ -89,8 +89,29 @@ describe 'ironic::db' do { :database_connection => 'mysql+pymysql://ironic:ironic@localhost/ironic' } 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 + + 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 @@ -107,7 +128,7 @@ describe 'ironic::db' do { :database_connection => 'mysql+pymysql://ironic:ironic@localhost/ironic' } end - it { is_expected.not_to contain_package('ironic-backend-package') } + it { is_expected.not_to contain_package('db_backend_package') } end end diff --git a/spec/classes/ironic_init_spec.rb b/spec/classes/ironic_init_spec.rb index 643878b9..e5b21afd 100644 --- a/spec/classes/ironic_init_spec.rb +++ b/spec/classes/ironic_init_spec.rb @@ -27,12 +27,6 @@ describe 'ironic' do :verbose => false, :debug => false, :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_max_retries => 10, :database_idle_timeout => 3600, @@ -57,10 +51,6 @@ describe 'ironic' do end 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 before { params.merge!( :rabbit_hosts => ['127.0.0.1:5672'] ) } @@ -110,9 +100,9 @@ describe 'ironic' do end 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_password').with_value( params[:rabbit_password] ) - 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_userid').with_value('') + is_expected.to contain_ironic_config('oslo_messaging_rabbit/rabbit_password').with_value('') + is_expected.to contain_ironic_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value('') is_expected.to contain_ironic_config('oslo_messaging_rabbit/rabbit_password').with_secret( true ) end @@ -130,23 +120,24 @@ describe 'ironic' 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/control_exchange').with_value('openstack') + is_expected.to contain_ironic_config('DEFAULT/rpc_response_timeout').with_value('') + is_expected.to contain_ironic_config('DEFAULT/control_exchange').with_value('') end end shared_examples_for 'rabbit HA with a single virtual host' 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_port').with_ensure('absent') + is_expected.to contain_ironic_config('oslo_messaging_rabbit/rabbit_host').with_value('') + is_expected.to contain_ironic_config('oslo_messaging_rabbit/rabbit_port').with_value('') 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('') end end shared_examples_for 'rabbit HA with multiple hosts' 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_port').with_ensure('absent') + is_expected.to contain_ironic_config('oslo_messaging_rabbit/rabbit_host').with_value('') + is_expected.to contain_ironic_config('oslo_messaging_rabbit/rabbit_port').with_value('') 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) end @@ -181,10 +172,10 @@ describe 'ironic' 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/kombu_ssl_ca_certs').with_ensure('absent') - 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_keyfile').with_ensure('absent') - 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_ca_certs').with_value('') + is_expected.to contain_ironic_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_value('') + is_expected.to contain_ironic_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_value('') + is_expected.to contain_ironic_config('oslo_messaging_rabbit/kombu_ssl_version').with_value('') end end @@ -192,25 +183,21 @@ describe 'ironic' do before do params.merge!( :rabbit_use_ssl => false, - :kombu_ssl_ca_certs => 'undef', - :kombu_ssl_certfile => 'undef', - :kombu_ssl_keyfile => 'undef', - :kombu_ssl_version => 'TLSv1' ) end 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/kombu_ssl_ca_certs').with_ensure('absent') - 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_keyfile').with_ensure('absent') - 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_ca_certs').with_value('') + is_expected.to contain_ironic_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_value('') + is_expected.to contain_ironic_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_value('') + is_expected.to contain_ironic_config('oslo_messaging_rabbit/kombu_ssl_version').with_value('') end end 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('') } end shared_examples_for 'with amqp_durable_queues enabled' do