You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2015/03/05 06:37:03 UTC

cloudstack-cloudmonkey git commit: requester: unicode string improvements when printing spinner

Repository: cloudstack-cloudmonkey
Updated Branches:
  refs/heads/master 3d02ff3a6 -> 523e0bcd2


requester: unicode string improvements when printing spinner

Signed-off-by: Rohit Yadav <ro...@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/523e0bcd
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/tree/523e0bcd
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/diff/523e0bcd

Branch: refs/heads/master
Commit: 523e0bcd2a2798b0168bbbbd5672d5687c7e3092
Parents: 3d02ff3
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Thu Mar 5 11:06:37 2015 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Thu Mar 5 11:06:37 2015 +0530

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


http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/blob/523e0bcd/cloudmonkey/requester.py
----------------------------------------------------------------------
diff --git a/cloudmonkey/requester.py b/cloudmonkey/requester.py
index e9bd452..7266ee7 100644
--- a/cloudmonkey/requester.py
+++ b/cloudmonkey/requester.py
@@ -271,11 +271,11 @@ def monkeyrequest(command, args, isasync, asyncblock, logger, url,
         if not timeout:
             timeout = 3600
         timeout = int(timeout)
-        cursor = itertools.cycle(['|', '/', '-', '\\'])
+        cursor = itertools.cycle([u'|', u'/', u'-', u'\\'])
         while timeout > 0:
             interval = 2
             while interval > 0:
-                print '\r' + cursor.next(),
+                sys.stdout.write(u"%s\r" % cursor.next())
                 sys.stdout.flush()
                 time.sleep(0.1)
                 interval -= 0.1
@@ -304,7 +304,8 @@ def monkeyrequest(command, args, isasync, asyncblock, logger, url,
                         jobid, jobresult["errorcode"], jobresult["errortext"])
                 return response, error
             elif jobstatus == 1:
-                print "\r  "
+                sys.stdout.write(u"\r \n")
+                sys.stdout.flush()
                 return response, error
             elif jobstatus == 0:
                 pass  # Job in progress