Skip to content

Commit 7b7488d

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Fix functional.base.TestCase.openstack() to optionally omit --os-auth-type"
2 parents 0001404 + 3b2863e commit 7b7488d

1 file changed

Lines changed: 19 additions & 5 deletions

File tree

  • openstackclient/tests/functional

openstackclient/tests/functional/base.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,30 @@ class TestCase(testtools.TestCase):
4444

4545
@classmethod
4646
def openstack(cls, cmd, cloud=ADMIN_CLOUD, fail_ok=False):
47-
"""Executes openstackclient command for the given action."""
48-
if cloud is not None:
47+
"""Executes openstackclient command for the given action
48+
49+
NOTE(dtroyer): There is a subtle distinction between pasing
50+
cloud=None and cloud='': for compatibility reasons passing
51+
cloud=None continues to include the option '--os-auth-type none'
52+
in the command while passing cloud='' omits the '--os-auth-type'
53+
option completely to let the default handlers be invoked.
54+
"""
55+
if cloud is None:
56+
# Execute command with no auth
4957
return execute(
50-
'openstack --os-cloud={cloud} '.format(cloud=cloud) + cmd,
58+
'openstack --os-auth-type none ' + cmd,
59+
fail_ok=fail_ok
60+
)
61+
elif cloud == '':
62+
# Execute command with no auth options at all
63+
return execute(
64+
'openstack ' + cmd,
5165
fail_ok=fail_ok
5266
)
5367
else:
54-
# Execute command with no auth
68+
# Execure command with an explicit cloud specified
5569
return execute(
56-
'openstack --os-auth-type none ' + cmd,
70+
'openstack --os-cloud=' + cloud + ' ' + cmd,
5771
fail_ok=fail_ok
5872
)
5973

0 commit comments

Comments
 (0)