Repository: cloudstack-cloudmonkey
Updated Branches:
  refs/heads/master b3f276d20 -> 242b8e7ed


requester: handle error when no response is found in the API response

Signed-off-by: Rohit Yadav <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/commit/242b8e7e
Tree: 
http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/tree/242b8e7e
Diff: 
http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/diff/242b8e7e

Branch: refs/heads/master
Commit: 242b8e7ed3688ca137b7879da6c3a5774deeda06
Parents: b3f276d
Author: Rohit Yadav <[email protected]>
Authored: Tue Jul 14 13:23:23 2015 +0530
Committer: Rohit Yadav <[email protected]>
Committed: Tue Jul 14 13:23:55 2015 +0530

----------------------------------------------------------------------
 cloudmonkey/requester.py | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/blob/242b8e7e/cloudmonkey/requester.py
----------------------------------------------------------------------
diff --git a/cloudmonkey/requester.py b/cloudmonkey/requester.py
index f2c225c..6dd292a 100644
--- a/cloudmonkey/requester.py
+++ b/cloudmonkey/requester.py
@@ -277,6 +277,9 @@ def monkeyrequest(command, args, isasync, asyncblock, 
logger, url,
     if not response or not isinstance(response, dict):
         return response, error
 
+    if 'response' not in response:
+        return response, 'Invalid response received: %s' % response
+
     isasync = isasync and (asyncblock == "true" or asyncblock == "True")
     responsekey = filter(lambda x: 'response' in x, response.keys())[0]
 

Reply via email to