Update AODH for using puppet-oslo

This commit switches using of oslo options to a puppet-oslo module:
* oslo messaging notifications;
* oslo messaging rabbitmq;
* oslo log;
* oslo db;

Change-Id: I6a989915df2529febaf980ddedc11f699d49147e
This commit is contained in:
Denis Egorenko 2016-03-29 15:28:08 +03:00
parent 4cc0e6498f
commit 4b22b9b289
6 changed files with 81 additions and 216 deletions

View File

@ -43,8 +43,6 @@ class aodh::db (
$database_max_overflow = 20, $database_max_overflow = 20,
) { ) {
include ::aodh::params
$database_connection_real = pick($::aodh::database_connection, $database_connection) $database_connection_real = pick($::aodh::database_connection, $database_connection)
$database_idle_timeout_real = pick($::aodh::database_idle_timeout, $database_idle_timeout) $database_idle_timeout_real = pick($::aodh::database_idle_timeout, $database_idle_timeout)
$database_min_pool_size_real = pick($::aodh::database_min_pool_size, $database_min_pool_size) $database_min_pool_size_real = pick($::aodh::database_min_pool_size, $database_min_pool_size)
@ -53,52 +51,13 @@ class aodh::db (
$database_retry_interval_real = pick($::aodh::database_retry_interval, $database_retry_interval) $database_retry_interval_real = pick($::aodh::database_retry_interval, $database_retry_interval)
$database_max_overflow_real = pick($::aodh::database_max_overflow, $database_max_overflow) $database_max_overflow_real = pick($::aodh::database_max_overflow, $database_max_overflow)
validate_re($database_connection_real, oslo::db { 'aodh_config':
'^(sqlite|mysql(\+pymysql)?|postgresql|mongodb):\/\/(\S+:\S+@\S+\/\S+)?') connection => $database_connection_real,
idle_timeout => $database_idle_timeout_real,
if $database_connection_real { min_pool_size => $database_min_pool_size_real,
case $database_connection_real { max_pool_size => $database_max_pool_size_real,
/^mysql(\+pymysql)?:\/\//: { max_retries => $database_max_retries_real,
require 'mysql::bindings' retry_interval => $database_retry_interval_real,
require 'mysql::bindings::python' max_overflow => $database_max_overflow_real,
if $database_connection_real =~ /^mysql\+pymysql/ {
$backend_package = $::aodh::params::pymysql_package_name
} else {
$backend_package = false
}
}
/^postgresql:\/\//: {
$backend_package = false
require 'postgresql::lib::python'
}
/^mongodb:\/\//: {
$backend_package = $::aodh::params::pymongo_package_name
}
/^sqlite:\/\//: {
$backend_package = $::aodh::params::sqlite_package_name
}
default: {
fail('Unsupported backend configured')
}
}
if $backend_package and !defined(Package[$backend_package]) {
package {'aodh-backend-package':
ensure => present,
name => $backend_package,
tag => 'openstack',
}
}
aodh_config {
'database/connection': value => $database_connection_real, secret => true;
'database/idle_timeout': value => $database_idle_timeout_real;
'database/min_pool_size': value => $database_min_pool_size_real;
'database/max_retries': value => $database_max_retries_real;
'database/retry_interval': value => $database_retry_interval_real;
'database/max_pool_size': value => $database_max_pool_size_real;
'database/max_overflow': value => $database_max_overflow_real;
}
} }
} }

View File

@ -69,21 +69,21 @@
# #
# [*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 # 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).
# 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).
# 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.
# 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
@ -222,10 +222,10 @@ class aodh (
$rabbit_heartbeat_timeout_threshold = 0, $rabbit_heartbeat_timeout_threshold = 0,
$rabbit_heartbeat_rate = 2, $rabbit_heartbeat_rate = 2,
$rabbit_ha_queues = undef, $rabbit_ha_queues = undef,
$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 = '1.0',
$amqp_durable_queues = false, $amqp_durable_queues = false,
$verbose = undef, $verbose = undef,
@ -259,19 +259,6 @@ class aodh (
include ::aodh::db include ::aodh::db
include ::aodh::logging include ::aodh::logging
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')
}
package { 'aodh': package { 'aodh':
ensure => $ensure_package, ensure => $ensure_package,
name => $::aodh::params::common_package_name, name => $::aodh::params::common_package_name,
@ -279,69 +266,26 @@ class aodh (
} }
if $rpc_backend == 'rabbit' { if $rpc_backend == 'rabbit' {
# I may want to support exporting and collecting these oslo::messaging::rabbit { 'aodh_config':
rabbit_userid => $rabbit_userid,
rabbit_password => $rabbit_password,
rabbit_virtual_host => $rabbit_virtual_host,
rabbit_host => $rabbit_host,
rabbit_port => $rabbit_port,
rabbit_hosts => $rabbit_hosts,
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_reconnect_delay => $kombu_reconnect_delay,
kombu_ssl_version => $kombu_ssl_version,
kombu_ssl_keyfile => $kombu_ssl_keyfile,
kombu_ssl_certfile => $kombu_ssl_certfile,
kombu_ssl_ca_certs => $kombu_ssl_ca_certs,
}
aodh_config { aodh_config {
'oslo_messaging_rabbit/rabbit_password': value => $rabbit_password, secret => true; 'DEFAULT/amqp_durable_queues': value => $amqp_durable_queues;
'oslo_messaging_rabbit/rabbit_userid': value => $rabbit_userid;
'oslo_messaging_rabbit/rabbit_virtual_host': value => $rabbit_virtual_host;
'oslo_messaging_rabbit/rabbit_use_ssl': value => $rabbit_use_ssl;
'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;
'DEFAULT/amqp_durable_queues': value => $amqp_durable_queues;
}
if $rabbit_use_ssl {
if $kombu_ssl_ca_certs {
aodh_config { 'oslo_messaging_rabbit/kombu_ssl_ca_certs': value => $kombu_ssl_ca_certs; }
} else {
aodh_config { 'oslo_messaging_rabbit/kombu_ssl_ca_certs': ensure => absent; }
}
if $kombu_ssl_certfile or $kombu_ssl_keyfile {
aodh_config {
'oslo_messaging_rabbit/kombu_ssl_certfile': value => $kombu_ssl_certfile;
'oslo_messaging_rabbit/kombu_ssl_keyfile': value => $kombu_ssl_keyfile;
}
} else {
aodh_config {
'oslo_messaging_rabbit/kombu_ssl_certfile': ensure => absent;
'oslo_messaging_rabbit/kombu_ssl_keyfile': ensure => absent;
}
}
if $kombu_ssl_version {
aodh_config { 'oslo_messaging_rabbit/kombu_ssl_version': value => $kombu_ssl_version; }
} else {
aodh_config { 'oslo_messaging_rabbit/kombu_ssl_version': ensure => absent; }
}
} else {
aodh_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 {
aodh_config { 'oslo_messaging_rabbit/rabbit_hosts': value => join($rabbit_hosts, ',') }
} else {
aodh_config { 'oslo_messaging_rabbit/rabbit_host': value => $rabbit_host }
aodh_config { 'oslo_messaging_rabbit/rabbit_port': value => $rabbit_port }
aodh_config { 'oslo_messaging_rabbit/rabbit_hosts': value => "${rabbit_host}:${rabbit_port}" }
}
if $rabbit_ha_queues == undef {
if $rabbit_hosts {
aodh_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => true }
} else {
aodh_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => false }
}
} else {
aodh_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => $rabbit_ha_queues }
} }
} }
@ -349,18 +293,13 @@ class aodh (
warning('Qpid driver was removed from Oslo.messaging in Mitaka release') warning('Qpid driver was removed from Oslo.messaging in Mitaka release')
} }
if $notification_driver { oslo::messaging::notifications { 'aodh_config':
aodh_config { driver => $notification_driver,
'DEFAULT/notification_driver': value => join(any2array($notification_driver), ','); topics => $notification_topics,
}
} else {
aodh_config { 'DEFAULT/notification_driver': ensure => absent; }
} }
aodh_config { aodh_config {
'DEFAULT/rpc_backend': value => $rpc_backend;
'DEFAULT/notification_topics': value => $notification_topics;
'DEFAULT/gnocchi_url': value => $gnocchi_url; 'DEFAULT/gnocchi_url': value => $gnocchi_url;
'database/alarm_history_time_to_live': value => $alarm_history_time_to_live; 'database/alarm_history_time_to_live': value => $alarm_history_time_to_live;
} }
} }

View File

@ -120,29 +120,23 @@ class aodh::logging(
$verbose_real = pick($::aodh::verbose,$verbose) $verbose_real = pick($::aodh::verbose,$verbose)
$debug_real = pick($::aodh::debug,$debug) $debug_real = pick($::aodh::debug,$debug)
if is_service_default($default_log_levels) { oslo::log { 'aodh_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_syslog => $use_syslog_real,
} use_stderr => $use_stderr_real,
log_dir => $log_dir_real,
aodh_config { syslog_log_facility => $log_facility_real,
'DEFAULT/debug' : value => $debug_real; logging_context_format_string => $logging_context_format_string,
'DEFAULT/verbose' : value => $verbose_real; logging_default_format_string => $logging_default_format_string,
'DEFAULT/use_stderr' : value => $use_stderr_real; logging_debug_format_suffix => $logging_debug_format_suffix,
'DEFAULT/use_syslog' : value => $use_syslog_real; logging_exception_prefix => $logging_exception_prefix,
'DEFAULT/log_dir' : value => $log_dir_real; log_config_append => $log_config_append,
'DEFAULT/syslog_log_facility' : value => $log_facility_real; default_log_levels => $default_log_levels,
'DEFAULT/logging_context_format_string' : value => $logging_context_format_string; publish_errors => $publish_errors,
'DEFAULT/logging_default_format_string' : value => $logging_default_format_string; fatal_deprecations => $fatal_deprecations,
'DEFAULT/logging_debug_format_suffix' : value => $logging_debug_format_suffix; log_date_format => $log_date_format,
'DEFAULT/logging_exception_prefix' : value => $logging_exception_prefix; instance_format => $instance_format,
'DEFAULT/log_config_append' : value => $log_config_append; instance_uuid_format => $instance_uuid_format,
'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

@ -29,6 +29,7 @@
"dependencies": [ "dependencies": [
{ "name": "puppetlabs/inifile", "version_requirement": ">=1.0.0 <2.0.0" }, { "name": "puppetlabs/inifile", "version_requirement": ">=1.0.0 <2.0.0" },
{ "name": "puppetlabs/stdlib", "version_requirement": ">= 4.2.0 <5.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" }
] ]
} }

View File

@ -6,7 +6,6 @@ describe 'aodh::db' do
context 'with default parameters' do context 'with default parameters' do
it { is_expected.to contain_class('aodh::params') }
it { is_expected.to contain_aodh_config('database/connection').with_value('sqlite:////var/lib/aodh/aodh.sqlite') } it { is_expected.to contain_aodh_config('database/connection').with_value('sqlite:////var/lib/aodh/aodh.sqlite') }
it { is_expected.to contain_aodh_config('database/idle_timeout').with_value('3600') } it { is_expected.to contain_aodh_config('database/idle_timeout').with_value('3600') }
it { is_expected.to contain_aodh_config('database/min_pool_size').with_value('1') } it { is_expected.to contain_aodh_config('database/min_pool_size').with_value('1') }
@ -25,7 +24,6 @@ describe 'aodh::db' do
} }
end end
it { is_expected.to contain_class('aodh::params') }
it { is_expected.to contain_aodh_config('database/connection').with_value('mysql+pymysql://aodh:aodh@localhost/aodh').with_secret(true) } it { is_expected.to contain_aodh_config('database/connection').with_value('mysql+pymysql://aodh:aodh@localhost/aodh').with_secret(true) }
it { is_expected.to contain_aodh_config('database/idle_timeout').with_value('3601') } it { is_expected.to contain_aodh_config('database/idle_timeout').with_value('3601') }
it { is_expected.to contain_aodh_config('database/min_pool_size').with_value('2') } it { is_expected.to contain_aodh_config('database/min_pool_size').with_value('2') }
@ -59,7 +57,7 @@ describe 'aodh::db' do
end end
it 'installs python-mongodb package' do it 'installs python-mongodb package' do
is_expected.to contain_package('aodh-backend-package').with( is_expected.to contain_package('db_backend_package').with(
:ensure => 'present', :ensure => 'present',
:name => 'python-pymongo', :name => 'python-pymongo',
:tag => 'openstack' :tag => 'openstack'
@ -94,7 +92,7 @@ describe 'aodh::db' do
end end
it 'install the proper backend package' do it 'install the proper backend package' do
is_expected.to contain_package('aodh-backend-package').with( is_expected.to contain_package('db_backend_package').with(
:ensure => 'present', :ensure => 'present',
:name => 'python-pysqlite2', :name => 'python-pysqlite2',
:tag => 'openstack' :tag => 'openstack'
@ -108,7 +106,7 @@ describe 'aodh::db' do
end end
it 'install the proper backend package' do it 'install the proper backend package' do
is_expected.to contain_package('aodh-backend-package').with( is_expected.to contain_package('db_backend_package').with(
:ensure => 'present', :ensure => 'present',
:name => 'python-pymysql', :name => 'python-pymysql',
:tag => 'openstack' :tag => 'openstack'
@ -123,7 +121,7 @@ describe 'aodh::db' do
{ :database_connection => 'mysql+pymysql://aodh:aodh@localhost/aodh', } { :database_connection => 'mysql+pymysql://aodh:aodh@localhost/aodh', }
end end
it { is_expected.not_to contain_package('aodh-backend-package') } it { is_expected.not_to contain_package('db_backend_package') }
end end
end end

View File

@ -26,7 +26,7 @@ describe 'aodh' do
is_expected.to contain_aodh_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value('/') is_expected.to contain_aodh_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value('/')
is_expected.to contain_aodh_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('0') is_expected.to contain_aodh_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('0')
is_expected.to contain_aodh_config('oslo_messaging_rabbit/heartbeat_rate').with_value('2') is_expected.to contain_aodh_config('oslo_messaging_rabbit/heartbeat_rate').with_value('2')
is_expected.to contain_aodh_config('DEFAULT/notification_driver').with_ensure('absent') is_expected.to contain_aodh_config('oslo_messaging_notifications/driver').with_value('<SERVICE DEFAULT>')
is_expected.to contain_aodh_config('database/alarm_history_time_to_live').with_value('<SERVICE DEFAULT>') is_expected.to contain_aodh_config('database/alarm_history_time_to_live').with_value('<SERVICE DEFAULT>')
end end
end end
@ -63,15 +63,15 @@ describe 'aodh' do
end end
it 'configures various things' do it 'configures various things' do
is_expected.to contain_aodh_config('DEFAULT/notification_driver').with_value('ceilometer.compute.aodh_notifier') is_expected.to contain_aodh_config('oslo_messaging_notifications/driver').with_value('ceilometer.compute.aodh_notifier')
is_expected.to contain_aodh_config('DEFAULT/notification_topics').with_value('openstack') is_expected.to contain_aodh_config('oslo_messaging_notifications/topics').with_value('openstack')
is_expected.to contain_aodh_config('DEFAULT/gnocchi_url').with_value('http://127.0.0.1:8041') is_expected.to contain_aodh_config('DEFAULT/gnocchi_url').with_value('http://127.0.0.1:8041')
end end
context 'with multiple notification_driver' do context 'with multiple notification_driver' do
before { params.merge!( :notification_driver => ['ceilometer.compute.aodh_notifier', 'aodh.openstack.common.notifier.rpc_notifier']) } before { params.merge!( :notification_driver => ['ceilometer.compute.aodh_notifier', 'aodh.openstack.common.notifier.rpc_notifier']) }
it { is_expected.to contain_aodh_config('DEFAULT/notification_driver').with_value( it { is_expected.to contain_aodh_config('oslo_messaging_notifications/driver').with_value(
'ceilometer.compute.aodh_notifier,aodh.openstack.common.notifier.rpc_notifier' 'ceilometer.compute.aodh_notifier,aodh.openstack.common.notifier.rpc_notifier'
) } ) }
end end
@ -84,17 +84,13 @@ describe 'aodh' do
end end
it 'configures rabbit' do it 'configures rabbit' do
is_expected.to_not contain_aodh_config('oslo_messaging_rabbit/rabbit_host') is_expected.to contain_aodh_config('oslo_messaging_rabbit/rabbit_host').with_value('<SERVICE DEFAULT>')
is_expected.to_not contain_aodh_config('oslo_messaging_rabbit/rabbit_port') is_expected.to contain_aodh_config('oslo_messaging_rabbit/rabbit_port').with_value('<SERVICE DEFAULT>')
is_expected.to contain_aodh_config('oslo_messaging_rabbit/rabbit_hosts').with_value('rabbit:5673,rabbit2:5674') is_expected.to contain_aodh_config('oslo_messaging_rabbit/rabbit_hosts').with_value('rabbit:5673,rabbit2:5674')
is_expected.to contain_aodh_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value(true) is_expected.to contain_aodh_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value(true)
is_expected.to contain_aodh_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value(false) is_expected.to contain_aodh_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value(false)
is_expected.to contain_aodh_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('1.0') is_expected.to contain_aodh_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('1.0')
is_expected.to contain_aodh_config('DEFAULT/amqp_durable_queues').with_value(false) is_expected.to contain_aodh_config('DEFAULT/amqp_durable_queues').with_value(false)
is_expected.to contain_aodh_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_ensure('absent')
is_expected.to contain_aodh_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_ensure('absent')
is_expected.to contain_aodh_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_ensure('absent')
is_expected.to contain_aodh_config('oslo_messaging_rabbit/kombu_ssl_version').with_ensure('absent')
end end
end end
@ -104,10 +100,10 @@ describe 'aodh' do
end end
it 'configures rabbit' do it 'configures rabbit' do
is_expected.to_not contain_aodh_config('oslo_messaging_rabbit/rabbit_host') is_expected.to contain_aodh_config('oslo_messaging_rabbit/rabbit_host').with_value('<SERVICE DEFAULT>')
is_expected.to_not contain_aodh_config('oslo_messaging_rabbit/rabbit_port') is_expected.to contain_aodh_config('oslo_messaging_rabbit/rabbit_port').with_value('<SERVICE DEFAULT>')
is_expected.to contain_aodh_config('oslo_messaging_rabbit/rabbit_hosts').with_value('rabbit:5673') is_expected.to contain_aodh_config('oslo_messaging_rabbit/rabbit_hosts').with_value('rabbit:5673')
is_expected.to contain_aodh_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value(true) is_expected.to contain_aodh_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('<SERVICE DEFAULT>')
is_expected.to contain_aodh_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value(false) is_expected.to contain_aodh_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value(false)
is_expected.to contain_aodh_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('1.0') is_expected.to contain_aodh_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('1.0')
is_expected.to contain_aodh_config('DEFAULT/amqp_durable_queues').with_value(false) is_expected.to contain_aodh_config('DEFAULT/amqp_durable_queues').with_value(false)
@ -152,23 +148,19 @@ describe 'aodh' do
end end
it 'configures rabbit' do it 'configures rabbit' do
is_expected.to_not contain_aodh_config('oslo_messaging_rabbit/rabbit_host') is_expected.to contain_aodh_config('oslo_messaging_rabbit/rabbit_host').with_value('<SERVICE DEFAULT>')
is_expected.to_not contain_aodh_config('oslo_messaging_rabbit/rabbit_port') is_expected.to contain_aodh_config('oslo_messaging_rabbit/rabbit_port').with_value('<SERVICE DEFAULT>')
is_expected.to contain_aodh_config('oslo_messaging_rabbit/rabbit_hosts').with_value('rabbit:5673') is_expected.to contain_aodh_config('oslo_messaging_rabbit/rabbit_hosts').with_value('rabbit:5673')
is_expected.to contain_aodh_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value(true) is_expected.to contain_aodh_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('<SERVICE DEFAULT>')
is_expected.to contain_aodh_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value(false) is_expected.to contain_aodh_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value(false)
is_expected.to contain_aodh_config('DEFAULT/amqp_durable_queues').with_value(true) is_expected.to contain_aodh_config('DEFAULT/amqp_durable_queues').with_value(true)
is_expected.to contain_aodh_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_ensure('absent')
is_expected.to contain_aodh_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_ensure('absent')
is_expected.to contain_aodh_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_ensure('absent')
is_expected.to contain_aodh_config('oslo_messaging_rabbit/kombu_ssl_version').with_ensure('absent')
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',
@ -187,33 +179,15 @@ describe 'aodh' 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_aodh_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value(true) is_expected.to contain_aodh_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value(true)
is_expected.to contain_aodh_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_ensure('absent') is_expected.to contain_aodh_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_value('<SERVICE DEFAULT>')
is_expected.to contain_aodh_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_ensure('absent') is_expected.to contain_aodh_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_value('<SERVICE DEFAULT>')
is_expected.to contain_aodh_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_ensure('absent') is_expected.to contain_aodh_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_value('<SERVICE DEFAULT>')
is_expected.to contain_aodh_config('oslo_messaging_rabbit/kombu_ssl_version').with_value('TLSv1') is_expected.to contain_aodh_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_aodh_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('false')
is_expected.to contain_aodh_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_ensure('absent')
is_expected.to contain_aodh_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_ensure('absent')
is_expected.to contain_aodh_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_ensure('absent')
is_expected.to contain_aodh_config('oslo_messaging_rabbit/kombu_ssl_version').with_ensure('absent')
end end
end end
end end