From 46c1220b383991b2641609b1a03a79e078798278 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Fri, 3 Nov 2023 16:34:36 +0900 Subject: [PATCH] Remove deprecated [designate] admin_* parameters These were deprecated during Xena cycle[1], so can be removed now. [1] adfd853267ca529816f4c17a145d9e70e8abfac5 Related-Bug: #1927494 Change-Id: I9fadaa6cfcd66409da47422505c145d9d67f6b8c --- .../conf/services/extdns_designate_driver.py | 36 --------- .../externaldns/drivers/designate/driver.py | 13 +-- .../ml2/extensions/test_dns_integration.py | 80 ------------------- ...designate-admin-opts-f3f4fe1037dbd75a.yaml | 11 +++ 4 files changed, 12 insertions(+), 128 deletions(-) create mode 100644 releasenotes/notes/remove-designate-admin-opts-f3f4fe1037dbd75a.yaml diff --git a/neutron/conf/services/extdns_designate_driver.py b/neutron/conf/services/extdns_designate_driver.py index 093fcc597e6..89f5395be10 100644 --- a/neutron/conf/services/extdns_designate_driver.py +++ b/neutron/conf/services/extdns_designate_driver.py @@ -21,42 +21,6 @@ from neutron._i18n import _ designate_opts = [ cfg.StrOpt('url', help=_('URL for connecting to designate')), - cfg.StrOpt('admin_username', - deprecated_for_removal=True, - deprecated_since='Xena', - deprecated_reason=("This option will be completely replaced by " - "keystoneauth parameters."), - help=_('Username for connecting to designate in admin ' - 'context')), - cfg.StrOpt('admin_password', - deprecated_for_removal=True, - deprecated_since='Xena', - deprecated_reason=("This option will be completely replaced by " - "keystoneauth parameters."), - help=_('Password for connecting to designate in admin ' - 'context'), - secret=True), - cfg.StrOpt('admin_tenant_id', - deprecated_for_removal=True, - deprecated_since='Xena', - deprecated_reason=("This option will be completely replaced by " - "keystoneauth parameters."), - help=_('Tenant id for connecting to designate in admin ' - 'context')), - cfg.StrOpt('admin_tenant_name', - deprecated_for_removal=True, - deprecated_since='Xena', - deprecated_reason=("This option will be completely replaced by " - "keystoneauth parameters."), - help=_('Tenant name for connecting to designate in admin ' - 'context')), - cfg.StrOpt('admin_auth_url', - deprecated_for_removal=True, - deprecated_since='Xena', - deprecated_reason=("This option will be completely replaced by " - "keystoneauth parameters."), - help=_('Authorization URL for connecting to designate in admin ' - 'context')), cfg.BoolOpt('allow_reverse_dns_lookup', default=True, help=_('Allow the creation of PTR records')), cfg.IntOpt( diff --git a/neutron/services/externaldns/drivers/designate/driver.py b/neutron/services/externaldns/drivers/designate/driver.py index 210ef7ab465..bc4a6e6c1f4 100644 --- a/neutron/services/externaldns/drivers/designate/driver.py +++ b/neutron/services/externaldns/drivers/designate/driver.py @@ -17,7 +17,6 @@ import netaddr from designateclient import exceptions as d_exc from designateclient.v2 import client as d_client -from keystoneauth1.identity.generic import password from keystoneauth1 import loading from keystoneauth1 import token_endpoint from neutron_lib import constants @@ -50,17 +49,7 @@ def get_clients(context): auth = token_endpoint.Token(CONF.designate.url, context.auth_token) client = d_client.Client(session=_SESSION, auth=auth) - if CONF.designate.auth_type: - admin_auth = loading.load_auth_from_conf_options( - CONF, 'designate') - else: - # TODO(tkajinam): Make this fail when admin_* parameters are removed. - admin_auth = password.Password( - auth_url=CONF.designate.admin_auth_url, - username=CONF.designate.admin_username, - password=CONF.designate.admin_password, - tenant_name=CONF.designate.admin_tenant_name, - tenant_id=CONF.designate.admin_tenant_id) + admin_auth = loading.load_auth_from_conf_options(CONF, 'designate') admin_client = d_client.Client(session=_SESSION, auth=admin_auth, endpoint_override=CONF.designate.url) return client, admin_client diff --git a/neutron/tests/unit/plugins/ml2/extensions/test_dns_integration.py b/neutron/tests/unit/plugins/ml2/extensions/test_dns_integration.py index 702f2b612be..1d1f9057b7f 100644 --- a/neutron/tests/unit/plugins/ml2/extensions/test_dns_integration.py +++ b/neutron/tests/unit/plugins/ml2/extensions/test_dns_integration.py @@ -760,83 +760,6 @@ class DNSDomainPortsTestCase(DNSIntegrationTestCase): dns_data_db, dns_data_db_1, dns_data_db_2) -class TestDesignateClientKeystoneV2(testtools.TestCase): - """Test case for designate clients """ - - TEST_URL = 'http://127.0.0.1:9001/v2' - TEST_ADMIN_USERNAME = uuidutils.generate_uuid(dashed=False) - TEST_ADMIN_PASSWORD = uuidutils.generate_uuid(dashed=False) - TEST_ADMIN_TENANT_NAME = uuidutils.generate_uuid(dashed=False) - TEST_ADMIN_TENANT_ID = uuidutils.generate_uuid(dashed=False) - TEST_ADMIN_AUTH_URL = 'http://127.0.0.1:35357/v2.0' - TEST_CA_CERT = uuidutils.generate_uuid(dashed=False) - - TEST_CONTEXT = mock.Mock() - TEST_CONTEXT.auth_token = uuidutils.generate_uuid(dashed=False) - - def setUp(self): - super(TestDesignateClientKeystoneV2, self).setUp() - cfg.CONF.set_override('url', - self.TEST_URL, - group='designate') - cfg.CONF.set_override('admin_username', - self.TEST_ADMIN_USERNAME, - group='designate') - cfg.CONF.set_override('admin_password', - self.TEST_ADMIN_PASSWORD, - group='designate') - cfg.CONF.set_override('admin_auth_url', - self.TEST_ADMIN_AUTH_URL, - group='designate') - cfg.CONF.set_override('admin_tenant_id', - self.TEST_ADMIN_TENANT_ID, - group='designate') - cfg.CONF.set_override('admin_tenant_name', - self.TEST_ADMIN_TENANT_NAME, - group='designate') - - # enforce session recalculation - mock.patch.object(driver, '_SESSION', new=None).start() - self.driver_session = ( - mock.patch.object(session, 'Session').start()) - self.load_auth = ( - mock.patch.object(driver.loading, - 'load_auth_from_conf_options').start()) - self.password = ( - mock.patch.object(driver.password, 'Password').start()) - - def test_insecure_client(self): - cfg.CONF.set_override('insecure', - True, - group='designate') - driver.get_clients(self.TEST_CONTEXT) - args, kwargs = self.driver_session.call_args - self.assertIn('verify', kwargs) - self.assertFalse(kwargs['verify'], False) - - def test_secure_client(self): - cfg.CONF.set_override('insecure', - False, - group='designate') - cfg.CONF.set_override('cafile', - self.TEST_CA_CERT, - group='designate') - driver.get_clients(self.TEST_CONTEXT) - args, kwargs = self.driver_session.call_args - self.assertIn('verify', kwargs) - self.assertEqual(kwargs['verify'], self.TEST_CA_CERT) - - def test_auth_type_not_defined(self): - driver.get_clients(self.TEST_CONTEXT) - self.load_auth.assert_not_called() - self.password.assert_called_with( - auth_url=self.TEST_ADMIN_AUTH_URL, - password=self.TEST_ADMIN_PASSWORD, - tenant_id=self.TEST_ADMIN_TENANT_ID, - tenant_name=self.TEST_ADMIN_TENANT_NAME, - username=self.TEST_ADMIN_USERNAME) - - class TestDesignateClientKeystoneV3(testtools.TestCase): """Test case for designate clients """ @@ -890,8 +813,6 @@ class TestDesignateClientKeystoneV3(testtools.TestCase): self.load_auth = ( mock.patch.object(driver.loading, 'load_auth_from_conf_options').start()) - self.password = ( - mock.patch.object(driver.password, 'Password').start()) def test_insecure_client(self): cfg.CONF.set_override('insecure', @@ -917,4 +838,3 @@ class TestDesignateClientKeystoneV3(testtools.TestCase): def test_auth_type_password(self): driver.get_clients(self.TEST_CONTEXT) self.load_auth.assert_called_with(cfg.CONF, 'designate') - self.password.assert_not_called() diff --git a/releasenotes/notes/remove-designate-admin-opts-f3f4fe1037dbd75a.yaml b/releasenotes/notes/remove-designate-admin-opts-f3f4fe1037dbd75a.yaml new file mode 100644 index 00000000000..5f5467f53f9 --- /dev/null +++ b/releasenotes/notes/remove-designate-admin-opts-f3f4fe1037dbd75a.yaml @@ -0,0 +1,11 @@ +--- +upgrade: + - | + The following parameters in the ``designate`` section have been removed. + + - ``admin_username`` + - ``admin_password`` + - ``admin_tenant_id`` + - ``admin_tenant_name`` + - ``admin_auth_url`` +