Updated Branches: refs/heads/master 5c24c34d7 -> a94f6f19b
cli: make parsing robust using shlex Parsing bug fixed using the simple lexical analysis library Signed-off-by: Rohit Yadav <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/a94f6f19 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/a94f6f19 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/a94f6f19 Branch: refs/heads/master Commit: a94f6f19bb5f57fca6ef94bf62139901758b4cf6 Parents: 5c24c34 Author: Rohit Yadav <[email protected]> Authored: Tue Nov 6 15:19:08 2012 +0530 Committer: Rohit Yadav <[email protected]> Committed: Tue Nov 6 15:19:08 2012 +0530 ---------------------------------------------------------------------- tools/cli/cloudmonkey/cloudmonkey.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a94f6f19/tools/cli/cloudmonkey/cloudmonkey.py ---------------------------------------------------------------------- diff --git a/tools/cli/cloudmonkey/cloudmonkey.py b/tools/cli/cloudmonkey/cloudmonkey.py index 8f9c0cc..4d2cc6d 100644 --- a/tools/cli/cloudmonkey/cloudmonkey.py +++ b/tools/cli/cloudmonkey/cloudmonkey.py @@ -27,6 +27,7 @@ try: import pdb import readline import rlcompleter + import shlex import sys import types @@ -216,7 +217,7 @@ class CloudStackShell(cmd.Cmd): return api_mod def default(self, args): - args = args.strip().split(" ") + args = shlex.split(args.strip()) api_name = args[0] try: @@ -231,7 +232,6 @@ class CloudStackShell(cmd.Cmd): command = api_cmd() response = api_rsp() - #FIXME: Parsing logic args_dict = dict(map(lambda x: [x.partition("=")[0], x.partition("=")[2]], args[1:])[x] for x in range(len(args) - 1))
