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: don't break on command parsing, just print error and return
Date Tue, 03 Feb 2015 07:03:15 GMT
Repository: cloudstack-cloudmonkey
Updated Branches:
  refs/heads/master 65bf70553 -> b0221bc3b


cloudmonkey: don't break on command parsing, just print error and return

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/b0221bc3
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/tree/b0221bc3
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/diff/b0221bc3

Branch: refs/heads/master
Commit: b0221bc3bdc4738a6c47acdae36a263f31eeb4eb
Parents: 65bf705
Author: Rohit Yadav <rohit.yadav@shapeblue.com>
Authored: Tue Feb 3 12:32:53 2015 +0530
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
Committed: Tue Feb 3 12:32:53 2015 +0530

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


http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/blob/b0221bc3/cloudmonkey/cloudmonkey.py
----------------------------------------------------------------------
diff --git a/cloudmonkey/cloudmonkey.py b/cloudmonkey/cloudmonkey.py
index 4144f2d..ac951ad 100644
--- a/cloudmonkey/cloudmonkey.py
+++ b/cloudmonkey/cloudmonkey.py
@@ -358,11 +358,15 @@ class CloudMonkeyShell(cmd.Cmd, object):
         lexp.posix = True
         args = []
         while True:
-            next_val = lexp.next()
-            if not next_val:
-                break
-            next_val = next_val.decode("utf-8")
-            args.append(next_val.replace(u'\x00', u''))
+            try:
+                next_val = lexp.next()
+                if not next_val:
+                    break
+                next_val = next_val.decode("utf-8")
+                args.append(next_val.replace(u'\x00', u''))
+            except ValueError, err:
+                self.monkeyprint("Command parsing error: ", err)
+                return
 
         args_dict = dict(map(lambda x: [x.partition("=")[0],
                                         x.partition("=")[2]],


Mime
View raw message