Deprecate rabbitmq connection parameters

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

Change-Id: I901eee39ae7da6164320f908a2719b8e35d46172
Related-Bug: #1625198
This commit is contained in:
Alex Schultz 2016-11-08 16:03:31 -07:00
parent 1032a9e41e
commit 8bf2f8c394
5 changed files with 110 additions and 63 deletions

View File

@ -51,26 +51,11 @@
# (optional) Service type to use when searching catalog
# Defaults to $::os_service_default.
#
# [*rabbit_hosts*]
# (optional) List of clustered rabbit servers.
# Defaults to the value set in the trove class.
# The default can generally be left unless the
# guests need to talk to the rabbit cluster via
# different IPs.
#
# [*rabbit_host*]
# (optional) Location of rabbitmq installation.
# Defaults to the value set in the trove class.
# The default can generally be left unless the
# guests need to talk to the rabbit cluster via
# a different IP.
#
# [*rabbit_port*]
# (optional) Port for rabbitmq instance.
# Defaults to the value set in the trove class.
# The default can generally be left unless the
# guests need to talk to the rabbit cluster via
# a different port.
# [*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 $::trove::default_transport_url
#
# [*rabbit_use_ssl*]
# (optional) Connect over SSL for RabbitMQ
@ -97,6 +82,27 @@
# (Optional) Moved to init.pp. The default exchange to scope topics.
# Defaults to undef.
#
# [*rabbit_hosts*]
# (optional) List of clustered rabbit servers.
# Defaults to the value set in the trove class.
# The default can generally be left unless the
# guests need to talk to the rabbit cluster via
# different IPs.
#
# [*rabbit_host*]
# (optional) Location of rabbitmq installation.
# Defaults to the value set in the trove class.
# The default can generally be left unless the
# guests need to talk to the rabbit cluster via
# a different IP.
#
# [*rabbit_port*]
# (optional) Port for rabbitmq instance.
# Defaults to the value set in the trove class.
# The default can generally be left unless the
# guests need to talk to the rabbit cluster via
# a different port.
#
class trove::guestagent(
$enabled = true,
$manage_service = true,
@ -109,20 +115,29 @@ class trove::guestagent(
$auth_url = 'http://localhost:5000/v2.0',
$swift_url = $::os_service_default,
$swift_service_type = $::os_service_default,
$rabbit_hosts = $::trove::rabbit_hosts,
$rabbit_host = $::trove::rabbit_host,
$rabbit_port = $::trove::rabbit_port,
$default_transport_url = $::trove::default_transport_url,
$rabbit_use_ssl = $::trove::rabbit_use_ssl,
$root_grant = $::os_service_default,
$root_grant_option = $::os_service_default,
$default_password_length = $::os_service_default,
#Deprecated
$control_exchange = undef,
$rabbit_hosts = $::trove::rabbit_hosts,
$rabbit_host = $::trove::rabbit_host,
$rabbit_port = $::trove::rabbit_port,
) inherits trove {
include ::trove::deps
include ::trove::params
if !is_service_default($rabbit_host) or
!is_service_default($rabbit_hosts) or
!is_service_default($rabbit_port) {
warning("trove::guestagent::rabbit_host, trove::guestagent::rabbit_hosts, \
and trove::guestagent::rabbit_port are deprecated. Please use \
trove::guestagent::default_transport_url instead.")
}
# basic service config
trove_guestagent_config {
'DEFAULT/trove_auth_url': value => $auth_url;
@ -134,7 +149,7 @@ class trove::guestagent(
}
oslo::messaging::default { 'trove_guestagent_config':
transport_url => $::trove::default_transport_url,
transport_url => $default_transport_url,
control_exchange => $::trove::control_exchange
}

View File

@ -43,36 +43,6 @@
# (optional) AMQP topic used for OpenStack notifications
# Defaults to $::os_service_default
#
# [*rabbit_host*]
# (optional) Location of rabbitmq installation.
# Note that, for security reasons, this rabbitmq host should not be the
# same that the core openstack services are using for communication. See
# http://lists.openstack.org/pipermail/openstack-dev/2015-April/061759.html
# Defaults to $::os_service_default
#
# [*rabbit_hosts*]
# (optional) List of clustered rabbit servers.
# Note that, for security reasons, these rabbitmq hosts should not be the
# same that the core openstack services are using for communication. See
# http://lists.openstack.org/pipermail/openstack-dev/2015-April/061759.html
# Defaults to $::os_service_default
#
# [*rabbit_port*]
# (optional) Port for rabbitmq instance.
# Defaults to $::os_service_default
#
# [*rabbit_password*]
# (optional) Password used to connect to rabbitmq.
# Defaults to $::os_service_default
#
# [*rabbit_userid*]
# (optional) User used to connect to rabbitmq.
# Defaults to $::os_service_default
#
# [*rabbit_virtual_host*]
# (optional) The RabbitMQ virtual host.
# Defaults to $::os_service_default
#
# [*rabbit_use_ssl*]
# (optional) Connect over SSL for RabbitMQ
# Defaults to $::os_service_default
@ -277,18 +247,44 @@
# (optional) The state of the package.
# Defaults to 'present'
#
# === DEPRECATED PARAMETERS
#
# [*rabbit_host*]
# (optional) Location of rabbitmq installation.
# Note that, for security reasons, this rabbitmq host should not be the
# same that the core openstack services are using for communication. See
# http://lists.openstack.org/pipermail/openstack-dev/2015-April/061759.html
# Defaults to $::os_service_default
#
# [*rabbit_hosts*]
# (optional) List of clustered rabbit servers.
# Note that, for security reasons, these rabbitmq hosts should not be the
# same that the core openstack services are using for communication. See
# http://lists.openstack.org/pipermail/openstack-dev/2015-April/061759.html
# Defaults to $::os_service_default
#
# [*rabbit_port*]
# (optional) Port for rabbitmq instance.
# Defaults to $::os_service_default
#
# [*rabbit_password*]
# (optional) Password used to connect to rabbitmq.
# Defaults to $::os_service_default
#
# [*rabbit_userid*]
# (optional) User used to connect to rabbitmq.
# Defaults to $::os_service_default
#
# [*rabbit_virtual_host*]
# (optional) The RabbitMQ virtual host.
# Defaults to $::os_service_default
#
class trove(
$nova_proxy_admin_pass,
$default_transport_url = $::os_service_default,
$notification_transport_url = $::os_service_default,
$notification_driver = $::os_service_default,
$notification_topics = $::os_service_default,
$rabbit_host = $::os_service_default,
$rabbit_hosts = $::os_service_default,
$rabbit_password = $::os_service_default,
$rabbit_port = $::os_service_default,
$rabbit_userid = $::os_service_default,
$rabbit_virtual_host = $::os_service_default,
$rabbit_use_ssl = $::os_service_default,
$rabbit_ha_queues = $::os_service_default,
$rabbit_notification_topic = $::os_service_default,
@ -337,10 +333,28 @@ class trove(
$neutron_service_type = 'network',
$use_neutron = true,
$package_ensure = 'present',
# DEPRECATED PARAMETERS
$rabbit_host = $::os_service_default,
$rabbit_hosts = $::os_service_default,
$rabbit_password = $::os_service_default,
$rabbit_port = $::os_service_default,
$rabbit_userid = $::os_service_default,
$rabbit_virtual_host = $::os_service_default,
) {
include ::trove::deps
include ::trove::params
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("trove::rabbit_host, trove::rabbit_hosts, trove::rabbit_password, \
trove::rabbit_port, trove::rabbit_userid and trove::rabbit_virtual_host are \
deprecated. Please use trove::default_transport_url instead.")
}
if $nova_compute_url {
trove_config { 'DEFAULT/nova_compute_url': value => $nova_compute_url }
}

View File

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

View File

@ -30,9 +30,7 @@ describe 'basic trove' do
# Trove resources
class { '::trove':
database_connection => 'mysql+pymysql://trove:a_big_secret@127.0.0.1/trove?charset=utf8',
rabbit_userid => 'trove',
rabbit_password => 'an_even_bigger_secret',
rabbit_host => '127.0.0.1',
default_transport_url => 'rabbit://trove:an_even_bigger_secret@127.0.0.1:5672/',
nova_proxy_admin_pass => 'a_big_secret',
}
class { '::trove::db::mysql':

View File

@ -94,6 +94,17 @@ describe 'trove::guestagent' do
end
end
context 'when using default transport url' do
let :pre_condition do
"class { 'trove':
nova_proxy_admin_pass => 'verysecrete',
default_transport_url => 'rabbit://user:pass@host:1234/virt',}"
end
it 'configures trove-guestagent with DEFAULT/transport_url' do
is_expected.to contain_trove_guestagent_config('DEFAULT/transport_url').with_value('rabbit://user:pass@host:1234/virt')
end
end
end
context 'with custom parameters' do