Cinder client fails if identity API version specified

The `CLIClient` class, which is used as an interface to various openstack related CLIs, however, the `--os-identity-api-version` option is not available outside of swift and openstack client.

When `--os-identity-api-version` is used except for swift and openstack clients, the following fixes were made to prevent passing options to the client.

- Add a statement in the `cmd_with_auth` method that `--os-identity-api-version` is used only for swift and openstack

Closes-Bug: #1980252
Change-Id: I8cfe63551cadd2f773c7455786b01f12e4843796
This commit is contained in:
Takemi Asakura
2023-02-16 19:40:45 +09:00
parent 5e9e677d8f
commit 30a269ceee
+7 -2
View File
@@ -97,6 +97,10 @@ class CLIClient(object):
:type identity_api_version: string
"""
CLIENTS_WITHOUT_IDENTITY_VERSION = ['nova', 'nova_manage', 'keystone',
'glance', 'ceilometer', 'heat',
'cinder', 'neutron', 'sahara']
def __init__(self, username='', password='', tenant_name='', uri='',
cli_dir='', insecure=False, prefix='', user_domain_name=None,
user_domain_id=None, project_domain_name=None,
@@ -377,8 +381,9 @@ class CLIClient(object):
self.password,
self.uri))
if self.identity_api_version:
creds += ' --os-identity-api-version %s' % (
self.identity_api_version)
if cmd not in self.CLIENTS_WITHOUT_IDENTITY_VERSION:
creds += ' --os-identity-api-version %s' % (
self.identity_api_version)
if self.user_domain_name is not None:
creds += ' --os-user-domain-name %s' % self.user_domain_name
if self.user_domain_id is not None: