Deprecate rabbitmq connection parameters

The rabbitmq connection parameters have been deprecated in favor of the
transport_url setting.

Change-Id: I43ac3079da9e52179457ca1a34f4faee60d5617b
Related-Bug: #1625198
This commit is contained in:
Alex Schultz 2016-11-08 13:30:06 -07:00
parent 3fca7a6b5d
commit 0fec267d07
4 changed files with 74 additions and 38 deletions

View File

@ -86,30 +86,10 @@
# If set, use this value for max_overflow with sqlalchemy.
# (Optional) Defaults to undef.
#
# [*rabbit_host*]
# (Optional) IP or hostname of the rabbit server.
# Defaults to $::os_service_default
#
# [*rabbit_port*]
# (Optional) Port of the rabbit server.
# 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 $::os_service_default
#
# [*rabbit_userid*]
# (Optional) User to connect to the rabbit server.
# Defaults to $::os_service_default
#
# [*rabbit_password*]
# (Required) Password to connect to the rabbit_server.
# Required if using the Rabbit (kombu) backend.
# Default to $::os_service_default
#
# [*rabbit_virtual_host*]
# (Optional) Virtual_host to use.
# [*default_transport_url*]
# (optional) A URL representing the messaging driver to use and its full
# configuration. Transport URLs take the form:
# transport://user:pass@host1:port[,hostN:portN]/virtual_host
# Defaults to $::os_service_default
#
# [*rabbit_ha_queues*]
@ -193,6 +173,34 @@
# in the mistral config.
# Defaults to false.
#
# === DEPRECATED PARAMTERS
#
# [*rabbit_host*]
# (Optional) IP or hostname of the rabbit server.
# Defaults to $::os_service_default
#
# [*rabbit_port*]
# (Optional) Port of the rabbit server.
# 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 $::os_service_default
#
# [*rabbit_userid*]
# (Optional) User to connect to the rabbit server.
# Defaults to $::os_service_default
#
# [*rabbit_password*]
# (Required) Password to connect to the rabbit_server.
# Required if using the Rabbit (kombu) backend.
# Default to $::os_service_default
#
# [*rabbit_virtual_host*]
# (Optional) Virtual_host to use.
# Defaults to $::os_service_default
#
class mistral(
$keystone_password,
$keystone_user = 'mistral',
@ -205,15 +213,10 @@ class mistral(
$os_actions_endpoint_type = $::os_service_default,
$control_exchange = $::os_service_default,
$rpc_response_timeout = $::os_service_default,
$rabbit_host = $::os_service_default,
$rabbit_port = $::os_service_default,
$rabbit_hosts = $::os_service_default,
$rabbit_virtual_host = $::os_service_default,
$default_transport_url = $::os_service_default,
$rabbit_ha_queues = $::os_service_default,
$rabbit_heartbeat_timeout_threshold = $::os_service_default,
$rabbit_heartbeat_rate = $::os_service_default,
$rabbit_userid = $::os_service_default,
$rabbit_password = $::os_service_default,
$rabbit_use_ssl = $::os_service_default,
$service_down_time = $::os_service_default,
$report_interval = $::os_service_default,
@ -231,6 +234,13 @@ class mistral(
$coordination_backend_url = $::os_service_default,
$coordination_heartbeat_interval = $::os_service_default,
$purge_config = false,
# DEPRECATED PARAMETERS
$rabbit_host = $::os_service_default,
$rabbit_port = $::os_service_default,
$rabbit_hosts = $::os_service_default,
$rabbit_userid = $::os_service_default,
$rabbit_password = $::os_service_default,
$rabbit_virtual_host = $::os_service_default,
){
include ::mistral::params
@ -239,6 +249,17 @@ class mistral(
validate_string($keystone_password)
if !is_service_default($rabbit_host) or
!is_service_default($rabbit_hosts) or
!is_service_default($rabbit_password) or
!is_service_default($rabbit_port) or
!is_service_default($rabbit_userid) or
!is_service_default($rabbit_virtual_host) {
warning("mistral::rabbit_host, mistral::rabbit_hosts, mistral::rabbit_password, \
mistral::rabbit_port, mistral::rabbit_userid and mistral::rabbit_virtual_host are \
deprecated. Please use mistral::default_transport_url instead.")
}
package { 'mistral-common':
ensure => $package_ensure,
name => $::mistral::params::common_package_name,
@ -263,6 +284,7 @@ class mistral(
}
oslo::messaging::default {'mistral_config':
transport_url => $default_transport_url,
control_exchange => $control_exchange,
rpc_response_timeout => $rpc_response_timeout,
}

View File

@ -0,0 +1,6 @@
---
deprecations:
- mistral::rabbit_host, mistral::rabbit_hosts, mistral::rabbit_password,
mistral::rabbit_port, mistral::rabbit_userid and
mistral::rabbit_virtual_host are deprecated.
mistral::default_transport_url should be used instead.

View File

@ -36,9 +36,7 @@ describe 'basic mistral' do
class { '::mistral':
database_connection => 'mysql+pymysql://mistral:a_big_secret@127.0.0.1/mistral?charset=utf8',
keystone_password => 'a_big_secret',
rabbit_userid => 'mistral',
rabbit_password => 'an_even_bigger_secret',
rabbit_host => '127.0.0.1',
default_transport_url => 'rabbit://mistral:an_even_bigger_secret@127.0.0.1:5672',
debug => true,
}
class { '::mistral::keystone::auth':

View File

@ -106,6 +106,16 @@ describe 'mistral' do
end
end
describe 'with rabbit transport url configured' do
let :params do
req_params.merge({'default_transport_url' => 'rabbit://user:pass@host:1234/virt' })
end
it 'should contain transport_url' do
is_expected.to contain_mistral_config('DEFAULT/transport_url').with(:value => 'rabbit://user:pass@host:1234/virt')
end
end
describe 'with rabbitmq heartbeats' do
let :params do
req_params.merge({'rabbit_heartbeat_timeout_threshold' => '60', 'rabbit_heartbeat_rate' => '10'})