From ae6a6b479dfe39fbeaf0989ccbd025e8496c1d38 Mon Sep 17 00:00:00 2001 From: Tobias Urdin Date: Sun, 21 Oct 2018 18:20:58 +0200 Subject: [PATCH] Remove deprecated rabbit options Remove the deprecated options rabbit_host, rabbit_port, rabbit_hosts, rabbit_userid, rabbit_password and rabbit_virtual_host [1]. All modules should support this change already or I have open patches that fixes it. Added a proper prelude notification that the functionality that changed rabbit_ha_queues to true automatically if rabbit_hosts was used is now removed so it has to be set explicitly. [1] https://review.openstack.org/#/c/599912/ Depends-On: https://review.openstack.org/#/c/612190/ Depends-On: https://review.openstack.org/#/c/612191/ Change-Id: Ie151e1857e6e951c676986c6b2778db0d0a52819 --- manifests/messaging/rabbit.pp | 64 +------------ ...cated-rabbit-options-212b21d41e6d2808.yaml | 14 +++ spec/defines/oslo_messaging_rabbit_spec.rb | 96 +------------------ 3 files changed, 18 insertions(+), 156 deletions(-) create mode 100644 releasenotes/notes/remove-deprecated-rabbit-options-212b21d41e6d2808.yaml diff --git a/manifests/messaging/rabbit.pp b/manifests/messaging/rabbit.pp index 80879dd..8eeec94 100644 --- a/manifests/messaging/rabbit.pp +++ b/manifests/messaging/rabbit.pp @@ -53,44 +53,18 @@ # (string value) # Defaults to $::os_service_default # -# [*rabbit_host*] -# (Optional) The RabbitMQ broker address where a single node is used. -# (string value) -# Defaults to $::os_service_default -# -# [*rabbit_port*] -# (Optional) The RabbitMQ broker port where a single node is used. -# (port value) -# Defaults to $::os_service_default -# # [*rabbit_qos_prefetch_count*] # (Optional) Specifies the number of messages to prefetch # Defaults to $::os_service_default # -# [*rabbit_hosts*] -# (Optional) RabbitMQ HA cluster host:port pairs. (array value) -# Defaults to $::os_service_default -# # [*rabbit_use_ssl*] # (Optional) Connect over SSL for RabbitMQ. (boolean value) # Defaults to $::os_service_default # -# [*rabbit_userid*] -# (Optional) The RabbitMQ userid. (string value) -# Defaults to $::os_service_default -# -# [*rabbit_password*] -# (Optional) The RabbitMQ password. (string value) -# Defaults to $::os_service_default -# # [*rabbit_login_method*] # (Optional) The RabbitMQ login method. (string value) # Defaults to $::os_service_default # -# [*rabbit_virtual_host*] -# (Optional) The RabbitMQ virtual host. (string value) -# Defaults to $::os_service_default -# # [*rabbit_retry_interval*] # (Optional) How frequently to retry connecting with RabbitMQ. # (integer value) @@ -139,15 +113,9 @@ define oslo::messaging::rabbit( $kombu_missing_consumer_retry_timeout = $::os_service_default, $kombu_failover_strategy = $::os_service_default, $kombu_compression = $::os_service_default, - $rabbit_host = $::os_service_default, - $rabbit_port = $::os_service_default, $rabbit_qos_prefetch_count = $::os_service_default, - $rabbit_hosts = $::os_service_default, $rabbit_use_ssl = $::os_service_default, - $rabbit_userid = $::os_service_default, - $rabbit_password = $::os_service_default, $rabbit_login_method = $::os_service_default, - $rabbit_virtual_host = $::os_service_default, $rabbit_retry_interval = $::os_service_default, $rabbit_retry_backoff = $::os_service_default, $rabbit_interval_max = $::os_service_default, @@ -176,30 +144,6 @@ define oslo::messaging::rabbit( fail('Unsupported Kombu compression. Possible values are gzip and bz2') } - if !is_service_default($rabbit_hosts) or !is_service_default($rabbit_host) { - warning("The oslo_messaging rabbit_host, rabbit_hosts, rabbit_port, rabbit_userid, \ -rabbit_password, rabbit_virtual_host parameters have been deprecated by the \ -[DEFAULT]\\transport_url. Please use oslo::messaging::default::transport_url instead.") - } - - if !is_service_default($rabbit_hosts) { - $rabbit_hosts_orig = join(any2array($rabbit_hosts), ',') - if size($rabbit_hosts) > 1 and is_service_default($rabbit_ha_queues) { - $rabbit_ha_queues_orig = true - } else { - $rabbit_ha_queues_orig = $rabbit_ha_queues - } - # Do not set rabbit_port and rabbit_host - $rabbit_port_orig = $::os_service_default - $rabbit_host_orig = $::os_service_default - } else { - $rabbit_port_orig = $rabbit_port - $rabbit_host_orig = $rabbit_host - $rabbit_ha_queues_orig = $rabbit_ha_queues - # Do not set rabbit_hosts if host or port or both are set - $rabbit_hosts_orig = $::os_service_default - } - $rabbit_options = { 'oslo_messaging_rabbit/amqp_durable_queues' => { value => $amqp_durable_queues }, 'oslo_messaging_rabbit/heartbeat_rate' => { value => $heartbeat_rate }, 'oslo_messaging_rabbit/heartbeat_timeout_threshold' => { value => $heartbeat_timeout_threshold }, @@ -209,18 +153,12 @@ rabbit_password, rabbit_virtual_host parameters have been deprecated by the \ 'oslo_messaging_rabbit/kombu_reconnect_delay' => { value => $kombu_reconnect_delay }, 'oslo_messaging_rabbit/rabbit_interval_max' => { value => $rabbit_interval_max }, 'oslo_messaging_rabbit/rabbit_login_method' => { value => $rabbit_login_method }, - 'oslo_messaging_rabbit/rabbit_password' => { value => $rabbit_password, secret => true }, 'oslo_messaging_rabbit/rabbit_retry_backoff' => { value => $rabbit_retry_backoff }, 'oslo_messaging_rabbit/rabbit_retry_interval' => { value => $rabbit_retry_interval }, 'oslo_messaging_rabbit/rabbit_transient_queues_ttl' => { value => $rabbit_transient_queues_ttl }, 'oslo_messaging_rabbit/ssl' => { value => $rabbit_use_ssl }, - 'oslo_messaging_rabbit/rabbit_userid' => { value => $rabbit_userid }, - 'oslo_messaging_rabbit/rabbit_virtual_host' => { value => $rabbit_virtual_host }, - 'oslo_messaging_rabbit/rabbit_hosts' => { value => $rabbit_hosts_orig }, - 'oslo_messaging_rabbit/rabbit_port' => { value => $rabbit_port_orig }, 'oslo_messaging_rabbit/rabbit_qos_prefetch_count' => { value => $rabbit_qos_prefetch_count }, - 'oslo_messaging_rabbit/rabbit_host' => { value => $rabbit_host_orig }, - 'oslo_messaging_rabbit/rabbit_ha_queues' => { value => $rabbit_ha_queues_orig }, + 'oslo_messaging_rabbit/rabbit_ha_queues' => { value => $rabbit_ha_queues }, 'oslo_messaging_rabbit/ssl_ca_file' => { value => $kombu_ssl_ca_certs }, 'oslo_messaging_rabbit/ssl_cert_file' => { value => $kombu_ssl_certfile }, 'oslo_messaging_rabbit/ssl_key_file' => { value => $kombu_ssl_keyfile }, diff --git a/releasenotes/notes/remove-deprecated-rabbit-options-212b21d41e6d2808.yaml b/releasenotes/notes/remove-deprecated-rabbit-options-212b21d41e6d2808.yaml new file mode 100644 index 0000000..c2ffe7c --- /dev/null +++ b/releasenotes/notes/remove-deprecated-rabbit-options-212b21d41e6d2808.yaml @@ -0,0 +1,14 @@ +--- +prelude: > + If you relied on the now removed rabbit_hosts parameters to set rabbit_ha_queues + to true automatically when you configured multiple hosts you must now explicitly + set it to true. +upgrade: + - | + The deprecated options rabbit_host, rabbit_port, rabbit_hosts, rabbit_userid, + rabbit_password and rabbit_virtual_host in oslo::messaging::rabbit has been + removed. Please use the transport_url in oslo::messaging::default instead. + - | + If you relied on the now removed rabbit_hosts parameters to set rabbit_ha_queues + to true automatically when you configured multiple hosts you must now explicitly + set it to true. diff --git a/spec/defines/oslo_messaging_rabbit_spec.rb b/spec/defines/oslo_messaging_rabbit_spec.rb index 48c3140..86ed934 100644 --- a/spec/defines/oslo_messaging_rabbit_spec.rb +++ b/spec/defines/oslo_messaging_rabbit_spec.rb @@ -13,15 +13,9 @@ describe 'oslo::messaging::rabbit' do is_expected.to contain_keystone_config('oslo_messaging_rabbit/kombu_missing_consumer_retry_timeout').with_value('') is_expected.to contain_keystone_config('oslo_messaging_rabbit/kombu_failover_strategy').with_value('') is_expected.to contain_keystone_config('oslo_messaging_rabbit/kombu_compression').with_value('') - is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_host').with_value('') - is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_port').with_value('') is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_qos_prefetch_count').with_value('') - is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_hosts').with_value('') is_expected.to contain_keystone_config('oslo_messaging_rabbit/ssl').with_value('') - is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_userid').with_value('') - is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_password').with_value('').with_secret(true) is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_login_method').with_value('') - is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value('') is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_retry_interval').with_value('') is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_retry_backoff').with_value('') is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_interval_max').with_value('') @@ -34,70 +28,22 @@ describe 'oslo::messaging::rabbit' do context 'with overridden parameters' do let :params do - { :rabbit_host => 'rabbit', - :rabbit_userid => 'rabbit_user', - :rabbit_port => '5673', - :rabbit_qos_prefetch_count => '10', - :rabbit_password => 'password', + { :rabbit_qos_prefetch_count => '10', :heartbeat_timeout_threshold => '60', :heartbeat_rate => '10', - :rabbit_virtual_host => '/', - :kombu_compression => 'bz2', } + :kombu_compression => 'bz2', + :rabbit_ha_queues => true, } end it 'configures rabbit' do - is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_host').with_value('rabbit') - is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_password').with_value('password').with_secret(true) - is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_port').with_value('5673') is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_qos_prefetch_count').with_value('10') - is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_userid').with_value('rabbit_user') - is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value('/') is_expected.to contain_keystone_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('60') is_expected.to contain_keystone_config('oslo_messaging_rabbit/heartbeat_rate').with_value('10') is_expected.to contain_keystone_config('oslo_messaging_rabbit/kombu_compression').with_value('bz2') - end - end - - context 'with rabbit_hosts parameter (one server)' do - let :params do - { :rabbit_hosts => ['rabbit:5672'] } - end - - it 'configures rabbit' do - is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_host').with_value('') - is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_port').with_value('') - is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_hosts').with_value('rabbit:5672') - is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('') - end - end - - context 'with rabbit_hosts parameter' do - let :params do - { :rabbit_hosts => ['rabbit1:5672', 'rabbit2:5673'] } - end - - it 'configures rabbit' do - is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_host').with_value('') - is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_port').with_value('') - is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_hosts').with_value('rabbit1:5672,rabbit2:5673') is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value(true) end end - context 'with rabbit_hosts parameter and disabled rabbit_ha_queues' do - let :params do - { :rabbit_hosts => ['rabbit1:5672', 'rabbit2:5673'], - :rabbit_ha_queues => false, } - end - - it 'configures rabbit' do - is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_host').with_value('') - is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_port').with_value('') - is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_hosts').with_value('rabbit1:5672,rabbit2:5673') - is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value(false) - end - end - context 'with rabbit ssl enabled with kombu' do let :params do { :rabbit_use_ssl => true, @@ -130,33 +76,6 @@ describe 'oslo::messaging::rabbit' do end end - context 'with rabbit host set without rabbit port' do - let :params do - { :rabbit_host => 'rabbit1' } - end - - it 'configures rabbit' do - is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_host').with_value('rabbit1') - is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_port').with_value('') - is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_hosts').with_value('') - is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('') - end - end - - context 'with rabbit host and port' do - let :params do - { :rabbit_host => 'rabbit1', - :rabbit_port => '5673' } - end - - it 'configures rabbit' do - is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_host').with_value('rabbit1') - is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_port').with_value('5673') - is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_hosts').with_value('') - is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('') - end - end - context 'with incorrect kombu compression' do let :params do { :kombu_compression => 'foo' } @@ -189,15 +108,6 @@ describe 'oslo::messaging::rabbit' do it { is_expected.to raise_error Puppet::Error, /The kombu_ssl_version parameter requires rabbit_use_ssl to be set to true/ } end - context 'with string in list parameters' do - let :params do - { :rabbit_hosts => 'rabbit1:5672,rabbit2:5673' } - end - - it 'configures rabbit with overridden list values as strings' do - is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_hosts').with_value('rabbit1:5672,rabbit2:5673') - end - end end on_supported_os({