From b2a83a660b166f086d8b74b97619047b9a3c94b3 Mon Sep 17 00:00:00 2001 From: Alex Schultz Date: Tue, 8 Nov 2016 13:03:50 -0700 Subject: [PATCH] Deprecate rabbitmq connection parameters The rabbitmq connection parameters have been deprecated in favor of the transport_url setting. Change-Id: Ie6ba6d6a34f858e236a7f6ed7de3e94fe8964a80 Related-Bug: #1625198 --- manifests/init.pp | 88 +++++++++++-------- ...n-params-deprecation-0550702bab0a1124.yaml | 6 ++ spec/acceptance/basic_magnum_spec.rb | 11 +-- spec/classes/magnum_init_spec.rb | 3 + 4 files changed, 64 insertions(+), 44 deletions(-) create mode 100644 releasenotes/notes/rabbit-connection-params-deprecation-0550702bab0a1124.yaml diff --git a/manifests/init.pp b/manifests/init.pp index e4466c1..e7bf33b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -17,28 +17,10 @@ # rabbit (for rabbitmq) # Defaults to 'rabbit' # -# [*rabbit_host*] -# (Optional) Host for rabbit server -# Defaults to $::os_service_default -# -# [*rabbit_hosts*] -# (Optional) List of clustered rabbit servers -# Defaults to $::os_service_default -# -# [*rabbit_port*] -# (Optional) Port for rabbit server -# Defaults to $::os_service_default -# -# [*rabbit_userid*] -# (Optional) Username used to connecting to rabbit -# Defaults to $::os_service_default -# -# [*rabbit_virtual_host*] -# (Optional) Virtual host for rabbit server -# Defaults to $::os_service_default -# -# [*rabbit_password*] -# (Optional) Password used to connect to rabbit +# [*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_use_ssl*] @@ -68,22 +50,50 @@ # in the magnum config. # Defaults to false. # +# === DEPRECATED PARAMTERS +# +# [*rabbit_host*] +# (Optional) Host for rabbit server +# Defaults to $::os_service_default +# +# [*rabbit_hosts*] +# (Optional) List of clustered rabbit servers +# Defaults to $::os_service_default +# +# [*rabbit_port*] +# (Optional) Port for rabbit server +# Defaults to $::os_service_default +# +# [*rabbit_userid*] +# (Optional) Username used to connecting to rabbit +# Defaults to $::os_service_default +# +# [*rabbit_virtual_host*] +# (Optional) Virtual host for rabbit server +# Defaults to $::os_service_default +# +# [*rabbit_password*] +# (Optional) Password used to connect to rabbit +# Defaults to $::os_service_default +# class magnum( - $package_ensure = 'present', - $notification_driver = $::os_service_default, - $rpc_backend = 'rabbit', - $rabbit_host = $::os_service_default, - $rabbit_hosts = $::os_service_default, - $rabbit_port = $::os_service_default, - $rabbit_userid = $::os_service_default, - $rabbit_virtual_host = $::os_service_default, - $rabbit_password = $::os_service_default, - $rabbit_use_ssl = $::os_service_default, - $kombu_ssl_ca_certs = $::os_service_default, - $kombu_ssl_certfile = $::os_service_default, - $kombu_ssl_keyfile = $::os_service_default, - $kombu_ssl_version = $::os_service_default, - $purge_config = false, + $package_ensure = 'present', + $notification_driver = $::os_service_default, + $rpc_backend = 'rabbit', + $default_transport_url = $::os_service_default, + $rabbit_use_ssl = $::os_service_default, + $kombu_ssl_ca_certs = $::os_service_default, + $kombu_ssl_certfile = $::os_service_default, + $kombu_ssl_keyfile = $::os_service_default, + $kombu_ssl_version = $::os_service_default, + $purge_config = false, + # DEPRECATED PARAMTERS + $rabbit_host = $::os_service_default, + $rabbit_hosts = $::os_service_default, + $rabbit_port = $::os_service_default, + $rabbit_userid = $::os_service_default, + $rabbit_virtual_host = $::os_service_default, + $rabbit_password = $::os_service_default, ) { include ::magnum::params @@ -124,6 +134,10 @@ class magnum( magnum_config { 'DEFAULT/rpc_backend': value => $rpc_backend } } + oslo::messaging::default { 'magnum_config': + transport_url => $default_transport_url, + } + oslo::messaging::notifications { 'magnum_config': driver => $notification_driver } diff --git a/releasenotes/notes/rabbit-connection-params-deprecation-0550702bab0a1124.yaml b/releasenotes/notes/rabbit-connection-params-deprecation-0550702bab0a1124.yaml new file mode 100644 index 0000000..fa5d82b --- /dev/null +++ b/releasenotes/notes/rabbit-connection-params-deprecation-0550702bab0a1124.yaml @@ -0,0 +1,6 @@ +--- +deprecations: + - magnum::rabbit_host, magnum::rabbit_hosts, magnum::rabbit_password, + magnum::rabbit_port, magnum::rabbit_userid and + magnum::rabbit_virtual_host are deprecated. + magnum::default_transport_url should be used instead. diff --git a/spec/acceptance/basic_magnum_spec.rb b/spec/acceptance/basic_magnum_spec.rb index 1c99b16..cc68007 100755 --- a/spec/acceptance/basic_magnum_spec.rb +++ b/spec/acceptance/basic_magnum_spec.rb @@ -61,13 +61,10 @@ describe 'basic magnum' do } class { '::magnum': - rabbit_host => '127.0.0.1', - rabbit_port => '5672', - rabbit_userid => 'magnum', - rabbit_password => 'an_even_bigger_secret', - rabbit_use_ssl => false, - notification_driver => 'messagingv2', - } + default_transport_url => 'rabbit://magnum:an_even_bigger_secret@127.0.0.1:5672/', + rabbit_use_ssl => false, + notification_driver => 'messagingv2', + } class { '::magnum::api': host => '127.0.0.1', diff --git a/spec/classes/magnum_init_spec.rb b/spec/classes/magnum_init_spec.rb index d59d879..9223f9c 100644 --- a/spec/classes/magnum_init_spec.rb +++ b/spec/classes/magnum_init_spec.rb @@ -38,6 +38,7 @@ describe 'magnum' do it 'configures rabbit' do is_expected.to contain_magnum_config('DEFAULT/rpc_backend').with_value('rabbit') + is_expected.to contain_magnum_config('DEFAULT/transport_url').with_value('') is_expected.to contain_magnum_config('oslo_messaging_rabbit/rabbit_host').with_value('') is_expected.to contain_magnum_config('oslo_messaging_rabbit/rabbit_password').with_value('').with_secret(true) is_expected.to contain_magnum_config('oslo_messaging_rabbit/rabbit_port').with_value('') @@ -55,6 +56,7 @@ describe 'magnum' do let :params do { :package_ensure => 'latest', :notification_driver => 'messagingv1', + :transport_url => 'rabbit://user:pass@host:1234/virt', :rabbit_host => '53.210.103.65', :rabbit_port => '1234', :rabbit_userid => 'me', @@ -72,6 +74,7 @@ describe 'magnum' do end it 'configures rabbit' do + is_expected.to contain_magnum_config('DEFAULT/transport_url').with_value('rabbit://user:pass@host:1234/virt') is_expected.to contain_magnum_config('oslo_messaging_rabbit/rabbit_host').with_value('53.210.103.65') is_expected.to contain_magnum_config('oslo_messaging_rabbit/rabbit_password').with_value('secrete').with_secret(true) is_expected.to contain_magnum_config('oslo_messaging_rabbit/rabbit_port').with_value('1234')