From 7ecadfbd0da6ae48574cad598e838c8eeb05b1bf Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Fri, 12 Jul 2024 11:31:21 +0900 Subject: [PATCH] Deprecate auth_version option The same option in tempest was deprecated by [1], because Identity v3 API is the only available version now. Deprecate the option and remove the old logic to support Identity v2 API which was already removed. [1] https://review.opendev.org/c/openstack/tempest/+/906158 Change-Id: Id12672fabfd51755eeff7b0d701abfb63e0abce0 --- heat_tempest_plugin/config.py | 3 ++ heat_tempest_plugin/services/clients.py | 31 ++++++++----------- ...precate-auth_version-45a3cbb9711ac0aa.yaml | 5 +++ 3 files changed, 21 insertions(+), 18 deletions(-) create mode 100644 releasenotes/notes/deprecate-auth_version-45a3cbb9711ac0aa.yaml diff --git a/heat_tempest_plugin/config.py b/heat_tempest_plugin/config.py index 786e11a..cb3adcd 100644 --- a/heat_tempest_plugin/config.py +++ b/heat_tempest_plugin/config.py @@ -59,6 +59,9 @@ HeatGroup = [ cfg.StrOpt('auth_url', help="Full URI of the OpenStack Identity API (Keystone)."), cfg.StrOpt('auth_version', + deprecated_for_removal=True, + deprecated_reason='Identity v2 API was removed and v3 is ' + 'the only available identity API version now', help="OpenStack Identity API version."), cfg.StrOpt('user_domain_name', help="User domain name, if keystone v3 auth_url " diff --git a/heat_tempest_plugin/services/clients.py b/heat_tempest_plugin/services/clients.py index ae4cbe2..ac3235d 100644 --- a/heat_tempest_plugin/services/clients.py +++ b/heat_tempest_plugin/services/clients.py @@ -62,18 +62,16 @@ class ClientManager(object): calling various OpenStack APIs. """ - CINDERCLIENT_VERSION = '3' - HEATCLIENT_VERSION = '1' + CINDER_API_VERSION = '3' + GNOCCHI_API_VERSION = '1' + HEAT_API_VERSION = '1' + KEYSTONE_API_VERSION = '3' NOVA_API_VERSION = '2.1' - GNOCCHI_VERSION = '1' def __init__(self, conf, admin_credentials=False): self.conf = conf self.admin_credentials = admin_credentials - self.auth_version = self.conf.auth_version - if not self.auth_version: - self.auth_version = self.conf.auth_url.split('/v')[1] self.insecure = self.conf.disable_ssl_certificate_validation self.ca_file = self.conf.ca_file @@ -108,7 +106,7 @@ class ClientManager(object): session = self.identity_client.session return heat_client.Client( - self.HEATCLIENT_VERSION, + self.HEAT_API_VERSION, endpoint, session=session, endpoint_type=self.conf.endpoint_type, @@ -126,15 +124,12 @@ class ClientManager(object): 'username': self._username(), 'password': self._password(), 'project_name': self._project_name(), - 'auth_url': self.conf.auth_url + 'auth_url': self.conf.auth_url, + 'user_domain_id': user_domain_id, + 'user_domain_name': user_domain_name, + 'project_domain_id': project_domain_id, + 'project_domain_name': project_domain_name } - # keystone v2 can't ignore domain details - if self.auth_version == '3': - kwargs.update({ - 'user_domain_id': user_domain_id, - 'project_domain_id': project_domain_id, - 'user_domain_name': user_domain_name, - 'project_domain_name': project_domain_name}) auth = password.Password(**kwargs) if self.insecure: verify_cert = False @@ -164,7 +159,7 @@ class ClientManager(object): def _get_volume_client(self): return cinder_client.Client( - self.CINDERCLIENT_VERSION, + self.CINDER_API_VERSION, session=self.identity_client.session, endpoint_type=self.conf.endpoint_type, region_name=self.conf.region, @@ -172,7 +167,7 @@ class ClientManager(object): def _get_object_client(self): args = { - 'auth_version': self.auth_version, + 'auth_version': self.KEYSTONE_API_VERSION, 'session': self.identity_client.session, 'cacert': self.ca_file, 'insecure': self.insecure, @@ -190,5 +185,5 @@ class ClientManager(object): 'session': self.identity_client.session, 'adapter_options': adapter_options } - return gnocchi_client.Client(version=self.GNOCCHI_VERSION, + return gnocchi_client.Client(version=self.GNOCCHI_API_VERSION, **args) diff --git a/releasenotes/notes/deprecate-auth_version-45a3cbb9711ac0aa.yaml b/releasenotes/notes/deprecate-auth_version-45a3cbb9711ac0aa.yaml new file mode 100644 index 0000000..206edad --- /dev/null +++ b/releasenotes/notes/deprecate-auth_version-45a3cbb9711ac0aa.yaml @@ -0,0 +1,5 @@ +--- +deprecations: + - | + The ``auth_version`` option has been deprecated and has no effect. This + option will be removed in a future release.