cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prachida...@apache.org
Subject [21/26] git commit: updated refs/heads/affinity_groups to 90172c3
Date Tue, 09 Apr 2013 22:49:01 GMT
cli: Handle URLError, variable refactor used passed variable

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>


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

Branch: refs/heads/affinity_groups
Commit: 63fa086fcc8c4bd47109c76f45f024b71a4c6e94
Parents: 6e22843
Author: Rohit Yadav <bhaisaab@apache.org>
Authored: Fri Apr 5 22:42:07 2013 +0530
Committer: Rohit Yadav <bhaisaab@apache.org>
Committed: Fri Apr 5 22:42:55 2013 +0530

----------------------------------------------------------------------
 tools/cli/cloudmonkey/requester.py |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/63fa086f/tools/cli/cloudmonkey/requester.py
----------------------------------------------------------------------
diff --git a/tools/cli/cloudmonkey/requester.py b/tools/cli/cloudmonkey/requester.py
index d58c1af..e6ea6a1 100644
--- a/tools/cli/cloudmonkey/requester.py
+++ b/tools/cli/cloudmonkey/requester.py
@@ -32,7 +32,7 @@ try:
     import types
     import urllib
     import urllib2
-    from urllib2 import urlopen, HTTPError
+    from urllib2 import urlopen, HTTPError, URLError
 
 except ImportError, e:
     print "Import error in %s : %s" % (__name__, e)
@@ -80,10 +80,12 @@ def make_request(command, args, logger, host, port,
         response = connection.read()
     except HTTPError, e:
         error = "%s: %s" % (e.msg, e.info().getheader('X-Description'))
+    except URLError, e:
+        error = e.reason
 
     logger_debug(logger, "Response received: %s" % response)
     if error is not None:
-        logger_debug(logger, "Error: error is not None, %s" % (error))
+        logger_debug(logger, "Error: %s" % (error))
         return response, error
 
     return response, error
@@ -91,7 +93,6 @@ def make_request(command, args, logger, host, port,
 
 def monkeyrequest(command, args, isasync, asyncblock, logger, host, port,
                   apikey, secretkey, timeout, protocol, path):
-    fcommand = command
     response = None
     error = None
     logger_debug(logger, "======== START Request ========")
@@ -133,9 +134,7 @@ def monkeyrequest(command, args, isasync, asyncblock, logger, host, port,
             timeout = timeout - pollperiod
             logger_debug(logger, "Job %s to timeout in %ds" % (jobid, timeout))
             sys.stdout.flush()
-            if re.match("queryAsyncJobResult", fcommand):
-                # logger_debug(logger, "%d loop: Job %s" % (progress, jobid))
-                # sys.stdout.flush()
+            if re.match("queryAsyncJobResult", command):
                 time.sleep(pollperiod)
             else:
                 response, error = monkeyrequest(command, request, isasync,


Mime
View raw message