Repository: cloudstack-cloudmonkey
Updated Branches:
  refs/heads/master ad69d2b9b -> 901154990


cloudmonkey: write errors to stderr

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

Branch: refs/heads/master
Commit: 901154990a23a7744cde7f49c552b99031c0c29b
Parents: ad69d2b
Author: Rohit Yadav <rohit.ya...@shapeblue.com>
Authored: Fri Oct 3 15:00:58 2014 +0200
Committer: Rohit Yadav <rohit.ya...@shapeblue.com>
Committed: Fri Oct 3 15:00:58 2014 +0200

----------------------------------------------------------------------
 cloudmonkey/cloudmonkey.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/blob/90115499/cloudmonkey/cloudmonkey.py
----------------------------------------------------------------------
diff --git a/cloudmonkey/cloudmonkey.py b/cloudmonkey/cloudmonkey.py
index bb01247..bd0f6c7 100644
--- a/cloudmonkey/cloudmonkey.py
+++ b/cloudmonkey/cloudmonkey.py
@@ -174,7 +174,10 @@ class CloudMonkeyShell(cmd.Cmd, object):
         if self.color == 'true':
             monkeyprint(output)
         else:
-            print(output)
+            if output.startswith("Error"):
+                sys.stderr.write(output)
+            else:
+                print output
 
     def print_result(self, result, result_filter=None):
         if result is None or len(result) == 0:
@@ -284,7 +287,7 @@ class CloudMonkeyShell(cmd.Cmd, object):
                                         self.url, self.credentials,
                                         self.timeout, self.expires)
         if error is not None:
-            self.monkeyprint(error)
+            self.monkeyprint("Error " + error)
         return response
 
     def default(self, args):
@@ -483,7 +486,7 @@ class CloudMonkeyShell(cmd.Cmd, object):
             self.credentials['session'] = session
             self.credentials['sessionkey'] = sessionkey
         except Exception, e:
-            print "Error while trying to log in to the server: ", str(e)
+            self.monkeyprint("Error: Login failed to the server: ", str(e))
 
     def do_logout(self, args):
         """

Reply via email to