cli auth: only inject project name if provided

One can create and need to execute execute functional
tests which may operate with a different scope, i.e. without
a project name. This was not previously functional as the
tempest method would always inject a project name when
none was provided, which would then result in commands
being executed with "--os-project-name None" which would
result in the command failing.

Change-Id: Ieeed191addb277f0c39c7a11f1f77034915be7fc
This commit is contained in:
Julia Kreger 2024-02-10 15:47:14 -08:00
parent 0edee3b8d8
commit 41a06110b2

View File

@ -374,12 +374,13 @@ class CLIClient(object):
:param merge_stderr: if True the stderr buffer is merged into stdout
:type merge_stderr: boolean
"""
creds = ('--os-username %s --os-project-name %s --os-password %s '
creds = ('--os-username %s --os-password %s '
'--os-auth-url %s' %
(self.username,
self.tenant_name,
self.password,
self.uri))
if self.tenant_name is not None:
creds += ' --os-project-name %s' % self.tenant_name
if self.identity_api_version:
if cmd not in self.CLIENTS_WITHOUT_IDENTITY_VERSION:
creds += ' --os-identity-api-version %s' % (