cli: make parsing robust using shlex

Parsing bug fixed using the simple lexical analysis library

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
This commit is contained in:
Rohit Yadav 2012-11-06 15:19:08 +05:30
parent 5c24c34d7f
commit a94f6f19bb
1 changed files with 2 additions and 2 deletions

View File

@ -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))