diff options
| author | Zuul <zuul@review.opendev.org> | 2019-08-23 19:40:13 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2019-08-23 19:40:13 +0000 |
| commit | 7b7488d51c795fac6b0e1c9c99a895b06bb3a4a8 (patch) | |
| tree | 586b0737fd490c5ce8ef327f5233359450d8fe0e /openstackclient | |
| parent | 0001404d7dc8e00877ab2e35992e89a42908d71f (diff) | |
| parent | 3b2863e369ef472042a054e11d189b6fbc34bb42 (diff) | |
| download | python-openstackclient-7b7488d51c795fac6b0e1c9c99a895b06bb3a4a8.tar.gz | |
Merge "Fix functional.base.TestCase.openstack() to optionally omit --os-auth-type"
Diffstat (limited to 'openstackclient')
| -rw-r--r-- | openstackclient/tests/functional/base.py | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/openstackclient/tests/functional/base.py b/openstackclient/tests/functional/base.py index c34ca393..08e9390e 100644 --- a/openstackclient/tests/functional/base.py +++ b/openstackclient/tests/functional/base.py @@ -44,16 +44,30 @@ class TestCase(testtools.TestCase): @classmethod def openstack(cls, cmd, cloud=ADMIN_CLOUD, fail_ok=False): - """Executes openstackclient command for the given action.""" - if cloud is not None: + """Executes openstackclient command for the given action + + NOTE(dtroyer): There is a subtle distinction between pasing + cloud=None and cloud='': for compatibility reasons passing + cloud=None continues to include the option '--os-auth-type none' + in the command while passing cloud='' omits the '--os-auth-type' + option completely to let the default handlers be invoked. + """ + if cloud is None: + # Execute command with no auth return execute( - 'openstack --os-cloud={cloud} '.format(cloud=cloud) + cmd, + 'openstack --os-auth-type none ' + cmd, + fail_ok=fail_ok + ) + elif cloud == '': + # Execute command with no auth options at all + return execute( + 'openstack ' + cmd, fail_ok=fail_ok ) else: - # Execute command with no auth + # Execure command with an explicit cloud specified return execute( - 'openstack --os-auth-type none ' + cmd, + 'openstack --os-cloud=' + cloud + ' ' + cmd, fail_ok=fail_ok ) |
