From 0fec267d079d48e0e0dcb257d32fe6d7fade0177 Mon Sep 17 00:00:00 2001 From: Alex Schultz Date: Tue, 8 Nov 2016 13:30:06 -0700 Subject: [PATCH] Deprecate rabbitmq connection parameters The rabbitmq connection parameters have been deprecated in favor of the transport_url setting. Change-Id: I43ac3079da9e52179457ca1a34f4faee60d5617b Related-Bug: #1625198 --- manifests/init.pp | 86 ++++++++++++------- ...n-params-deprecation-8f2abf8d3cb0594d.yaml | 6 ++ spec/acceptance/basic_mistral_spec.rb | 10 +-- spec/classes/mistral_init_spec.rb | 10 +++ 4 files changed, 74 insertions(+), 38 deletions(-) create mode 100644 releasenotes/notes/rabbit-connection-params-deprecation-8f2abf8d3cb0594d.yaml diff --git a/manifests/init.pp b/manifests/init.pp index 3472626..abdeb42 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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,8 +284,9 @@ class mistral( } oslo::messaging::default {'mistral_config': - control_exchange => $control_exchange, - rpc_response_timeout => $rpc_response_timeout, + transport_url => $default_transport_url, + control_exchange => $control_exchange, + rpc_response_timeout => $rpc_response_timeout, } if $rpc_backend in [$::os_service_default, 'rabbit'] { diff --git a/releasenotes/notes/rabbit-connection-params-deprecation-8f2abf8d3cb0594d.yaml b/releasenotes/notes/rabbit-connection-params-deprecation-8f2abf8d3cb0594d.yaml new file mode 100644 index 0000000..f613987 --- /dev/null +++ b/releasenotes/notes/rabbit-connection-params-deprecation-8f2abf8d3cb0594d.yaml @@ -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. diff --git a/spec/acceptance/basic_mistral_spec.rb b/spec/acceptance/basic_mistral_spec.rb index 0681bf2..9153e9c 100644 --- a/spec/acceptance/basic_mistral_spec.rb +++ b/spec/acceptance/basic_mistral_spec.rb @@ -34,12 +34,10 @@ describe 'basic mistral' do } 'RedHat': { 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', - debug => true, + database_connection => 'mysql+pymysql://mistral:a_big_secret@127.0.0.1/mistral?charset=utf8', + keystone_password => 'a_big_secret', + default_transport_url => 'rabbit://mistral:an_even_bigger_secret@127.0.0.1:5672', + debug => true, } class { '::mistral::keystone::auth': password => 'a_big_secret', diff --git a/spec/classes/mistral_init_spec.rb b/spec/classes/mistral_init_spec.rb index 0310000..8eee9a1 100644 --- a/spec/classes/mistral_init_spec.rb +++ b/spec/classes/mistral_init_spec.rb @@ -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'})