Fix functional.base.TestCase.openstack() to optionally omit --os-auth-type
Change the functional test TestCase.openstack() method to add a way to not include the --os-auth-type option in order to test the default auth-type logic. Change-Id: I0f1ca2f7517a41278afaad5aaf4e98accb16bea2 Signed-off-by: Dean Troyer <dtroyer@gmail.com>
This commit is contained in:
parent
a15e4741fa
commit
3b2863e369
@ -44,18 +44,32 @@ class TestCase(testtools.TestCase):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def openstack(cls, cmd, cloud=ADMIN_CLOUD, fail_ok=False):
|
def openstack(cls, cmd, cloud=ADMIN_CLOUD, fail_ok=False):
|
||||||
"""Executes openstackclient command for the given action."""
|
"""Executes openstackclient command for the given action
|
||||||
if cloud is not None:
|
|
||||||
return execute(
|
NOTE(dtroyer): There is a subtle distinction between pasing
|
||||||
'openstack --os-cloud={cloud} '.format(cloud=cloud) + cmd,
|
cloud=None and cloud='': for compatibility reasons passing
|
||||||
fail_ok=fail_ok
|
cloud=None continues to include the option '--os-auth-type none'
|
||||||
)
|
in the command while passing cloud='' omits the '--os-auth-type'
|
||||||
else:
|
option completely to let the default handlers be invoked.
|
||||||
|
"""
|
||||||
|
if cloud is None:
|
||||||
# Execute command with no auth
|
# Execute command with no auth
|
||||||
return execute(
|
return execute(
|
||||||
'openstack --os-auth-type none ' + cmd,
|
'openstack --os-auth-type none ' + cmd,
|
||||||
fail_ok=fail_ok
|
fail_ok=fail_ok
|
||||||
)
|
)
|
||||||
|
elif cloud == '':
|
||||||
|
# Execute command with no auth options at all
|
||||||
|
return execute(
|
||||||
|
'openstack ' + cmd,
|
||||||
|
fail_ok=fail_ok
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
# Execure command with an explicit cloud specified
|
||||||
|
return execute(
|
||||||
|
'openstack --os-cloud=' + cloud + ' ' + cmd,
|
||||||
|
fail_ok=fail_ok
|
||||||
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def is_service_enabled(cls, service):
|
def is_service_enabled(cls, service):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user