Updated Branches:
  refs/heads/master 2add554a6 -> 5c24c34d7

cli: use partition instead of split to parse through args

Use partition instead of splitting on whitespace. This is little robust, but
may still fail for parameters whose values have whitespaces such as names etc.

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

Branch: refs/heads/master
Commit: 5c24c34d7fbf5f15dfbb10909a4f9e48f97dafb7
Parents: 9e6b366
Author: Rohit Yadav <[email protected]>
Authored: Tue Nov 6 14:54:35 2012 +0530
Committer: Rohit Yadav <[email protected]>
Committed: Tue Nov 6 14:54:35 2012 +0530

----------------------------------------------------------------------
 tools/cli/cloudmonkey/cloudmonkey.py |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5c24c34d/tools/cli/cloudmonkey/cloudmonkey.py
----------------------------------------------------------------------
diff --git a/tools/cli/cloudmonkey/cloudmonkey.py 
b/tools/cli/cloudmonkey/cloudmonkey.py
index 8e4a79c..8f9c0cc 100644
--- a/tools/cli/cloudmonkey/cloudmonkey.py
+++ b/tools/cli/cloudmonkey/cloudmonkey.py
@@ -70,8 +70,8 @@ class CloudStackShell(cmd.Cmd):
             for key in self.config_fields.keys():
                 setattr(self, key, self.config_fields[key])
             config = self.write_config()
-            print("'🙉  Set your apiKey, secretKey, host, port, prompt, 
color, "
-                  "log_file, history_file using the set command!")
+            print("🙉  Set your apiKey, secretKey, host, port, prompt, 
color,"
+                  " log_file, history_file using the set command!")
 
         for key in self.config_fields.keys():
             setattr(self, key, config.get('CLI', key))
@@ -232,7 +232,8 @@ class CloudStackShell(cmd.Cmd):
         command = api_cmd()
         response = api_rsp()
         #FIXME: Parsing logic
-        args_dict = dict(map(lambda x: x.split("="),
+        args_dict = dict(map(lambda x: [x.partition("=")[0],
+                                        x.partition("=")[2]],
                              args[1:])[x] for x in range(len(args) - 1))
 
         for attribute in dir(command):

Reply via email to