cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject cloudstack-cloudmonkey git commit: cloudmonkey: add -a or --async flag to let cloudstack not block on async apis
Date Wed, 10 Dec 2014 17:06:07 GMT
Repository: cloudstack-cloudmonkey
Updated Branches:
  refs/heads/master aad3800f0 -> c75f2fc97


cloudmonkey: add -a or --async flag to let cloudstack not block on async apis

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>


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

Branch: refs/heads/master
Commit: c75f2fc970444b0be519a26569569e8a1085c635
Parents: aad3800
Author: Rohit Yadav <rohit.yadav@shapeblue.com>
Authored: Wed Dec 10 22:34:21 2014 +0530
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
Committed: Wed Dec 10 22:35:58 2014 +0530

----------------------------------------------------------------------
 CHANGES.md                 | 3 ++-
 cloudmonkey/cloudmonkey.py | 8 +++++++-
 cloudmonkey/requester.py   | 2 +-
 3 files changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/blob/c75f2fc9/CHANGES.md
----------------------------------------------------------------------
diff --git a/CHANGES.md b/CHANGES.md
index 0a68b16..c0de2e6 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -12,7 +12,8 @@ This release includes
 - Pass verifysslcert option while user logs in using username/password
 - Importing readline no longer outputs escape characters
 - CloudMonkey will not output extra empty lines in stdout output
-- New command line arg: -p for profile
+- New command line arg: -p or --profile (load server profile)
+- New command line arg: -a or --async (do not block on async APIs)
 
 Version 5.3.0
 =============

http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/blob/c75f2fc9/cloudmonkey/cloudmonkey.py
----------------------------------------------------------------------
diff --git a/cloudmonkey/cloudmonkey.py b/cloudmonkey/cloudmonkey.py
index 7880314..d77eff5 100644
--- a/cloudmonkey/cloudmonkey.py
+++ b/cloudmonkey/cloudmonkey.py
@@ -137,7 +137,7 @@ class CloudMonkeyShell(cmd.Cmd, object):
         pass
 
     def cmdloop(self, intro=None):
-        interpreterMode = True
+        self.interpreterMode = True
         print(self.intro)
         print "Using management server profile:", self.profile, "\n"
         while True:
@@ -751,6 +751,9 @@ def main():
                         dest="configFile", default=config_file,
                         help="config file for cloudmonkey", metavar="FILE")
 
+    parser.add_argument("-a", "--async", action="store_true",
+                        help="do not block on async API calls")
+
     parser.add_argument("-d", "--display-type",
                         dest="displayType", default=None,
                         help="output display type, json, table or default",
@@ -771,6 +774,9 @@ def main():
     if args.displayType and args.displayType in displayTypes:
         shell.set_attr("display", args.displayType)
 
+    if args.async:
+        shell.set_attr("asyncblock", "false")
+
     if args.serverProfile and args.serverProfile.strip() != '':
         shell.do_set("profile %s" % args.serverProfile)
 

http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/blob/c75f2fc9/cloudmonkey/requester.py
----------------------------------------------------------------------
diff --git a/cloudmonkey/requester.py b/cloudmonkey/requester.py
index 6be896a..0ba9f12 100644
--- a/cloudmonkey/requester.py
+++ b/cloudmonkey/requester.py
@@ -260,7 +260,7 @@ def monkeyrequest(command, args, isasync, asyncblock, logger, url,
     if not response or not isinstance(response, dict):
         return response, error
 
-    isasync = isasync and (asyncblock == "true")
+    isasync = isasync and (asyncblock == "true" or asyncblock == "True")
     responsekey = filter(lambda x: 'response' in x, response.keys())[0]
 
     if isasync and 'jobid' in response[responsekey]:


Mime
View raw message