You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2012/11/06 10:34:16 UTC
[3/5] git commit: cli: move code, refactor and add docstring
cli: move code, refactor and add docstring
Signed-off-by: Rohit Yadav <bh...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/a1089c43
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/a1089c43
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/a1089c43
Branch: refs/heads/master
Commit: a1089c4304f398c96c554b35ab9a3f39a66521b9
Parents: d0f9610
Author: Rohit Yadav <bh...@apache.org>
Authored: Tue Nov 6 14:25:48 2012 +0530
Committer: Rohit Yadav <bh...@apache.org>
Committed: Tue Nov 6 14:28:40 2012 +0530
----------------------------------------------------------------------
tools/cli/cloudmonkey/cloudmonkey.py | 38 ++++++++++++++++++----------
1 files changed, 24 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a1089c43/tools/cli/cloudmonkey/cloudmonkey.py
----------------------------------------------------------------------
diff --git a/tools/cli/cloudmonkey/cloudmonkey.py b/tools/cli/cloudmonkey/cloudmonkey.py
index 13e0252..dc20f22 100644
--- a/tools/cli/cloudmonkey/cloudmonkey.py
+++ b/tools/cli/cloudmonkey/cloudmonkey.py
@@ -195,20 +195,6 @@ class CloudStackShell(cmd.Cmd):
elif not (str(result) is None):
self.print_shell(result)
- def do_quit(self, s):
- """
- Quit Apache CloudStack CLI
- """
- self.print_shell("Bye!")
- return True
-
- def do_shell(self, args):
- """
- Execute shell commands using shell <command> or !<command>
- Example: !ls or shell ls
- """
- os.system(args)
-
def make_request(self, command, requests={}):
conn = cloudConnection(self.host, port=int(self.port),
apiKey=self.apiKey, securityKey=self.secretKey,
@@ -347,6 +333,30 @@ class CloudStackShell(cmd.Cmd):
['host', 'port', 'apiKey', 'secretKey', 'prompt', 'color',
'log_file', 'history_file'] if s.startswith(mline)]
+ def do_shell(self, args):
+ """
+ Execute shell commands using shell <command> or !<command>
+
+ Example:
+ !ls
+ shell ls
+ !for((i=0; i<10; i++)); do cloudmonkey create user account=admin \
+ email=test@test.tt firstname=user$i lastname=user$i \
+ password=password username=user$i; done
+ """
+ os.system(args)
+
+
+ def do_quit(self, args):
+ """
+ Quit Apache CloudStack CLI
+ """
+ self.print_shell("Bye!")
+ return self.do_EOF(args)
+
+ def do_EOF(self, args):
+ return True
+
def main():
# Add verbs in grammar