From 8881ed43784f6e3a62c7c32280ba92d53aabf678 Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Wed, 5 Sep 2018 14:46:09 +1000 Subject: [PATCH] Remove deprecated amqp1 options The amqp1 options allow_insecure_options, username and password are all deprecated, remove them. allow_insecure_options was deprecated during Ocata, and the other two were deprecated in 5.22.0, released during Pike. Change-Id: I321266c3dba83a38fe6ebd775db2e74c14cc96cd --- .../_drivers/amqp1_driver/controller.py | 19 +++++--------- oslo_messaging/_drivers/amqp1_driver/opts.py | 25 ------------------- .../tests/drivers/test_amqp_driver.py | 11 -------- 3 files changed, 6 insertions(+), 49 deletions(-) diff --git a/oslo_messaging/_drivers/amqp1_driver/controller.py b/oslo_messaging/_drivers/amqp1_driver/controller.py index 36a8e90f2..e801dd561 100644 --- a/oslo_messaging/_drivers/amqp1_driver/controller.py +++ b/oslo_messaging/_drivers/amqp1_driver/controller.py @@ -819,13 +819,10 @@ class NotificationServer(Server): class Hosts(object): """An order list of TransportHost addresses. Connection failover progresses - from one host to the next. username, password , and realm come from the - configuration and are used only if no username/password/realm is present in - the URL. + from one host to the next. The default realm comes from the configuration + and is only used if no realm is present in the URL. """ - def __init__(self, url, default_username=None, - default_password=None, - default_realm=None): + def __init__(self, url, default_realm=None): self.virtual_host = url.virtual_host if url.hosts: self._entries = url.hosts[:] @@ -834,8 +831,8 @@ class Hosts(object): port=5672)] for entry in self._entries: entry.port = entry.port or 5672 - entry.username = entry.username or default_username - entry.password = entry.password or default_password + entry.username = entry.username + entry.password = entry.password if default_realm and entry.username and '@' not in entry.username: entry.username = entry.username + '@' + default_realm self._current = random.randint(0, len(self._entries) - 1) # nosec @@ -894,16 +891,12 @@ class Controller(pyngus.ConnectionEventHandler): self.ssl_cert_file = config.oslo_messaging_amqp.ssl_cert_file self.ssl_key_file = config.oslo_messaging_amqp.ssl_key_file self.ssl_key_password = config.oslo_messaging_amqp.ssl_key_password - self.ssl_allow_insecure = \ - config.oslo_messaging_amqp.allow_insecure_clients self.ssl_verify_vhost = config.oslo_messaging_amqp.ssl_verify_vhost self.pseudo_vhost = config.oslo_messaging_amqp.pseudo_vhost self.sasl_mechanisms = config.oslo_messaging_amqp.sasl_mechanisms self.sasl_config_dir = config.oslo_messaging_amqp.sasl_config_dir self.sasl_config_name = config.oslo_messaging_amqp.sasl_config_name - self.hosts = Hosts(url, config.oslo_messaging_amqp.username, - config.oslo_messaging_amqp.password, - config.oslo_messaging_amqp.sasl_default_realm) + self.hosts = Hosts(url, config.oslo_messaging_amqp.sasl_default_realm) self.conn_retry_interval = \ config.oslo_messaging_amqp.connection_retry_interval self.conn_retry_backoff = \ diff --git a/oslo_messaging/_drivers/amqp1_driver/opts.py b/oslo_messaging/_drivers/amqp1_driver/opts.py index d40b6119b..91655242b 100644 --- a/oslo_messaging/_drivers/amqp1_driver/opts.py +++ b/oslo_messaging/_drivers/amqp1_driver/opts.py @@ -71,14 +71,6 @@ amqp1_opts = [ " if the server's SSL certificate uses the virtual host name" " instead of the DNS name."), - cfg.BoolOpt('allow_insecure_clients', - default=False, - deprecated_group='amqp1', - # marked as deprecated in Ocata - deprecated_for_removal=True, - deprecated_reason="Not applicable - not a SSL server", - help='Accept clients using either SSL or plain TCP'), - cfg.StrOpt('sasl_mechanisms', default='', deprecated_group='amqp1', @@ -98,23 +90,6 @@ amqp1_opts = [ default='', help='SASL realm to use if no realm present in username'), - cfg.StrOpt('username', - default='', - deprecated_group='amqp1', - deprecated_for_removal=True, - deprecated_reason='Should use configuration option ' - 'transport_url to provide the username.', - help='User name for message broker authentication'), - - cfg.StrOpt('password', - default='', - deprecated_group='amqp1', - secret=True, - deprecated_for_removal=True, - deprecated_reason='Should use configuration option ' - 'transport_url to provide the password.', - help='Password for message broker authentication'), - # Network connection failure retry options cfg.IntOpt('connection_retry_interval', diff --git a/oslo_messaging/tests/drivers/test_amqp_driver.py b/oslo_messaging/tests/drivers/test_amqp_driver.py index 2a8e97f62..20f52a42a 100644 --- a/oslo_messaging/tests/drivers/test_amqp_driver.py +++ b/oslo_messaging/tests/drivers/test_amqp_driver.py @@ -904,17 +904,6 @@ mech_list: ${mechs} addr, retry=0) - def test_authentication_default_username(self): - """Verify that a configured username/password is used if none appears - in the URL. - Deprecated: username password deprecated in favor of transport_url - """ - addr = "amqp://%s:%d" % (self._broker.host, self._broker.port) - self.config(username="joe@myrealm", - password="secret", - group="oslo_messaging_amqp") - self._authentication_test(addr) - def test_authentication_default_realm(self): """Verify that default realm is used if none present in username""" addr = "amqp://joe:secret@%s:%d" % (self._broker.host,