Merge "Deprecate rabbitmq connection parameters"

changes/17/397417/1
Jenkins 6 years ago committed by Gerrit Code Review
commit a86e414994
  1. 88
      manifests/notify/rabbitmq.pp
  2. 9
      releasenotes/notes/rabbit-connection-params-deprecation-d1405f1fe22481b8.yaml
  3. 12
      spec/classes/glance_notify_rabbitmq_spec.rb

@ -1,31 +1,11 @@
#
# used to configure rabbitmq notifications for glance
#
# [*rabbit_password*]
# (Optional) The RabbitMQ password. (string value)
# Defaults to $::os_service_default
#
# [*rabbit_userid*]
# (Optional) The RabbitMQ userid. (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_hosts*]
# (Optional) RabbitMQ HA cluster host:port pairs. (array 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_virtual_host*]
# (Optional) The RabbitMQ virtual host. (string value)
# Defaults to $::os_service_default
# [*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*]
# (Optional) Use HA queues in RabbitMQ (x-ha-policy: all). If you change this
@ -96,13 +76,36 @@
# messaging, messagingv2, routing, log, test, noop (multi valued)
# Defaults to $::os_service_default
#
# === DEPRECATED PARAMTERS
#
# [*rabbit_password*]
# (Optional) The RabbitMQ password. (string value)
# Defaults to $::os_service_default
#
# [*rabbit_userid*]
# (Optional) The RabbitMQ userid. (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_hosts*]
# (Optional) RabbitMQ HA cluster host:port pairs. (array 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_virtual_host*]
# (Optional) The RabbitMQ virtual host. (string value)
# Defaults to $::os_service_default
#
class glance::notify::rabbitmq(
$rabbit_password = $::os_service_default,
$rabbit_userid = $::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,
@ -117,10 +120,30 @@ class glance::notify::rabbitmq(
$amqp_durable_queues = $::os_service_default,
$kombu_compression = $::os_service_default,
$notification_driver = $::os_service_default,
# DEPRECATED PARAMETERS
$rabbit_password = $::os_service_default,
$rabbit_userid = $::os_service_default,
$rabbit_host = $::os_service_default,
$rabbit_port = $::os_service_default,
$rabbit_hosts = $::os_service_default,
$rabbit_virtual_host = $::os_service_default,
) {
include ::glance::deps
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("glance::notify::rabbitmq::rabbit_host, \
glance::notify::rabbitmq::rabbit_hosts, glance::notify::rabbitmq::rabbit_password, \
glance::notify::rabbitmq::rabbit_port, glance::notify::rabbitmq::rabbit_userid \
and glance::notify::rabbitmq::rabbit_virtual_host are \
deprecated. Please use glance::notify::rabbitmq::default_transport_url instead.")
}
oslo::messaging::rabbit { ['glance_api_config', 'glance_registry_config']:
rabbit_password => $rabbit_password,
rabbit_userid => $rabbit_userid,
@ -141,6 +164,9 @@ class glance::notify::rabbitmq(
kombu_compression => $kombu_compression,
}
oslo::messaging::default { ['glance_api_config', 'glance_registry_config']:
transport_url => $default_transport_url,
}
oslo::messaging::notifications { ['glance_api_config', 'glance_registry_config']:
driver => $notification_driver,

@ -0,0 +1,9 @@
---
deprecations:
- glance::notify::rabbitmq::rabbit_host,
glance::notify::rabbitmq::rabbit_hosts,
glance::notify::rabbitmq::rabbit_password,
glance::notify::rabbitmq::rabbit_port,
glance::notify::rabbitmq::rabbit_userid and
glance::notify::rabbitmq::rabbit_virtual_host are deprecated.
glance::notify::rabbitmq::default_transport_url should be used instead.

@ -3,6 +3,7 @@ describe 'glance::notify::rabbitmq' do
shared_examples_for 'glance::notify::rabbitmq' do
describe 'when defaults with rabbit pass specified' do
it { is_expected.to contain_glance_api_config('DEFAULT/transport_url').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_glance_api_config('oslo_messaging_notifications/driver').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_password').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_password').with_value('<SERVICE DEFAULT>').with_secret(true) }
@ -19,6 +20,7 @@ describe 'glance::notify::rabbitmq' do
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/heartbeat_rate').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_glance_registry_config('DEFAULT/transport_url').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_glance_registry_config('oslo_messaging_notifications/driver').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/rabbit_password').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/rabbit_password').with_value('<SERVICE DEFAULT>').with_secret(true) }
@ -191,6 +193,16 @@ describe 'glance::notify::rabbitmq' do
it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/heartbeat_rate').with_value('10') }
end
describe 'when passing params transport_url' do
let :params do
{
:default_transport_url => 'rabbit://user:pass@host:1234/virt',
}
end
it { is_expected.to contain_glance_api_config('DEFAULT/transport_url').with_value('rabbit://user:pass@host:1234/virt') }
it { is_expected.to contain_glance_registry_config('DEFAULT/transport_url').with_value('rabbit://user:pass@host:1234/virt') }
end
end
on_supported_os({

Loading…
Cancel
Save