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
This commit is contained in:
Takashi Kajinami 2024-07-12 11:31:21 +09:00
parent 3e0209ba8b
commit 7ecadfbd0d
3 changed files with 21 additions and 18 deletions

View File

@ -59,6 +59,9 @@ HeatGroup = [
cfg.StrOpt('auth_url', cfg.StrOpt('auth_url',
help="Full URI of the OpenStack Identity API (Keystone)."), help="Full URI of the OpenStack Identity API (Keystone)."),
cfg.StrOpt('auth_version', 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."), help="OpenStack Identity API version."),
cfg.StrOpt('user_domain_name', cfg.StrOpt('user_domain_name',
help="User domain name, if keystone v3 auth_url " help="User domain name, if keystone v3 auth_url "

View File

@ -62,18 +62,16 @@ class ClientManager(object):
calling various OpenStack APIs. calling various OpenStack APIs.
""" """
CINDERCLIENT_VERSION = '3' CINDER_API_VERSION = '3'
HEATCLIENT_VERSION = '1' GNOCCHI_API_VERSION = '1'
HEAT_API_VERSION = '1'
KEYSTONE_API_VERSION = '3'
NOVA_API_VERSION = '2.1' NOVA_API_VERSION = '2.1'
GNOCCHI_VERSION = '1'
def __init__(self, conf, admin_credentials=False): def __init__(self, conf, admin_credentials=False):
self.conf = conf self.conf = conf
self.admin_credentials = admin_credentials 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.insecure = self.conf.disable_ssl_certificate_validation
self.ca_file = self.conf.ca_file self.ca_file = self.conf.ca_file
@ -108,7 +106,7 @@ class ClientManager(object):
session = self.identity_client.session session = self.identity_client.session
return heat_client.Client( return heat_client.Client(
self.HEATCLIENT_VERSION, self.HEAT_API_VERSION,
endpoint, endpoint,
session=session, session=session,
endpoint_type=self.conf.endpoint_type, endpoint_type=self.conf.endpoint_type,
@ -126,15 +124,12 @@ class ClientManager(object):
'username': self._username(), 'username': self._username(),
'password': self._password(), 'password': self._password(),
'project_name': self._project_name(), '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) auth = password.Password(**kwargs)
if self.insecure: if self.insecure:
verify_cert = False verify_cert = False
@ -164,7 +159,7 @@ class ClientManager(object):
def _get_volume_client(self): def _get_volume_client(self):
return cinder_client.Client( return cinder_client.Client(
self.CINDERCLIENT_VERSION, self.CINDER_API_VERSION,
session=self.identity_client.session, session=self.identity_client.session,
endpoint_type=self.conf.endpoint_type, endpoint_type=self.conf.endpoint_type,
region_name=self.conf.region, region_name=self.conf.region,
@ -172,7 +167,7 @@ class ClientManager(object):
def _get_object_client(self): def _get_object_client(self):
args = { args = {
'auth_version': self.auth_version, 'auth_version': self.KEYSTONE_API_VERSION,
'session': self.identity_client.session, 'session': self.identity_client.session,
'cacert': self.ca_file, 'cacert': self.ca_file,
'insecure': self.insecure, 'insecure': self.insecure,
@ -190,5 +185,5 @@ class ClientManager(object):
'session': self.identity_client.session, 'session': self.identity_client.session,
'adapter_options': adapter_options 'adapter_options': adapter_options
} }
return gnocchi_client.Client(version=self.GNOCCHI_VERSION, return gnocchi_client.Client(version=self.GNOCCHI_API_VERSION,
**args) **args)

View File

@ -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.