Fix OpenStack CLI Get List error 28/80328/2
authorYi Yang <yangyi01@inspur.com>
Thu, 14 Feb 2019 03:38:12 +0000 (22:38 -0500)
committerYi Yang <yangyi01@inspur.com>
Thu, 14 Feb 2019 05:08:21 +0000 (00:08 -0500)
In OpenStack CLI Get List error, RequestsLibrary.To Json
    ${json} will result in exception if return value of
OpenStack CLI is empty, i.e. ${json} is empty, this will
terminate current keyword/test case, it isn't what we expect.

This commit fixed this error and make sure current keyword/test
case can be run normally.

Change-Id: If36e27f092e66920004cfc09e9a6d6ec88bf5b51
JIRA: INTTEST-56
Signed-off-by: Yi Yang <yangyi01@inspur.com>
csit/libraries/OpenStackOperations.robot

index a1ca371ac6ffdbe3cb6e52688663dce5a6c8668e..ec08b781ff81eecdbb09a48d9c73d88e455fcc2d 100644 (file)
@@ -1100,9 +1100,9 @@ OpenStack List All
 OpenStack CLI Get List
     [Arguments]    ${cmd}
     [Documentation]    Return a json list from the output of an OpenStack command.
-    @{list} =    BuiltIn.Create List
     ${json} =    OpenStack CLI    ${cmd}
-    @{list} =    RequestsLibrary.To Json    ${json}
+    @{list} =    BuiltIn.Run Keyword If    ${json}    RequestsLibrary.To Json    ${json}
+    ...    ELSE    BuiltIn.Create List
     BuiltIn.Log    ${list}
     [Return]    @{list}