Initialize 'result' variable in functional.base
Initialize 'result' variable as None in the method of functional.base.BaseTestCase.openstack to avoid UnboundLocalError when exception is raised. Change-Id: Id324d1b4395b23dfe7eb5e9d977c67ce6dbc22f7 Closes-bug: 1762717
This commit is contained in:
parent
16bb97c779
commit
006f1eb6d0
|
@ -26,6 +26,7 @@ class BaseTestCase(base.BaseTestCase):
|
|||
|
||||
@classmethod
|
||||
def openstack(cls, cmd, may_fail=False, use_json=False):
|
||||
result = None
|
||||
try:
|
||||
to_exec = ['openstack'] + cmd.split()
|
||||
if use_json:
|
||||
|
@ -41,7 +42,7 @@ class BaseTestCase(base.BaseTestCase):
|
|||
if not may_fail:
|
||||
raise
|
||||
|
||||
if use_json:
|
||||
if use_json and result:
|
||||
return json.loads(result)
|
||||
else:
|
||||
return result
|
||||
|
|
Loading…
Reference in New Issue