diff --git a/manifests/guestagent.pp b/manifests/guestagent.pp index bc651cb2..7d7644b4 100644 --- a/manifests/guestagent.pp +++ b/manifests/guestagent.pp @@ -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 } diff --git a/manifests/init.pp b/manifests/init.pp index 0a5d037e..945109c5 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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 } } diff --git a/releasenotes/notes/rabbit-connection-params-deprecation-8e209afd31c042a1.yaml b/releasenotes/notes/rabbit-connection-params-deprecation-8e209afd31c042a1.yaml new file mode 100644 index 00000000..e776bb6f --- /dev/null +++ b/releasenotes/notes/rabbit-connection-params-deprecation-8e209afd31c042a1.yaml @@ -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. diff --git a/spec/acceptance/basic_trove_spec.rb b/spec/acceptance/basic_trove_spec.rb index e3a44f97..cb33c455 100644 --- a/spec/acceptance/basic_trove_spec.rb +++ b/spec/acceptance/basic_trove_spec.rb @@ -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': diff --git a/spec/classes/trove_guestagent_spec.rb b/spec/classes/trove_guestagent_spec.rb index e3d9b8fa..07a6b053 100644 --- a/spec/classes/trove_guestagent_spec.rb +++ b/spec/classes/trove_guestagent_spec.rb @@ -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