71 Commits

Author SHA1 Message Date
Rohit Yadav
80d58b6c73 CLOUDSTACK-1317: Bump CloudStack package version to 4.2.0-SNAPSHOT in all poms
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-02-20 16:42:56 +05:30
Prasanna Santhanam
a4510efc24 maven: parent pom of tools/* projects is tools/pom.xml
Fixes broken builds for tools

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-02-18 10:26:49 +05:30
Prasanna Santhanam
05437d0e97 maven pom: put apache cloudstack tools together in umbrella pom
minor pom refactor to put all the tools under one placeholder pom.
Also adds a profile for marvin to run deployDataCenter via mvn options.

$mvn -Pdeveloper,marvin -pl :cloud-marvin -Dmarvin.config=<path/to/config>

OR
$cd tools/marvin
$mvn -Pmarvin -pl :cloud-marvin -Dmarvin.config=path/to/config

will deploy the datacenter using the marvin.config property's value

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-02-15 20:53:41 +05:30
Rohit Yadav
1fd0563137 CLOUDSTACK-1037: Implement fuzzy parameter completion
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-02-07 16:01:05 +05:30
Rohit Yadav
d99f836d5d cli: Fix attribute error and fix helpdoc
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-02-06 16:54:46 +05:30
Rohit Yadav
a2e89c4200 cli: Use metaprogramming to generate code during runtime when new apis sync
- Fixes metaprogramming to inject methods during shell class object's runtime
- This enable new apis that are synced to come up with new verbs, docs etc.
- Fixes printing issue
- Fixes null bitfield parsing issue

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-02-04 17:57:08 +05:30
Rohit Yadav
b5a2e99809 CLOUDSTACK-1037: Fix cloudmonkey's caching, autocompletion and printing
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-02-02 08:39:45 -08:00
Rohit Yadav
631b6fd46a CLOUDSTACK-1037: Make cloudmonkey awesome-er
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-02-01 14:34:49 -08:00
Rohit Yadav
cb8705c756 cli: Pygments based output in cloudmonkey and new cfg processing
- Pygments based colored output for tabular and normal list outputs
- Fix cfg processing as per new cfg paths and ds
- Get rid of clint and old way of parsing and color printing

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-01-28 17:59:37 -08:00
Rohit Yadav
233c0adcf3 cli: Fix common.py's cfg fields grouped under similarites like ui, core, user etc.
Changes config path to ~/.cloudmonkey this will break cfg path but all configs are
still backward compatible. We need folder to put a lot of stuff that is coming
for ex. themes and plugins

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-01-28 17:52:40 -08:00
Rohit Yadav
0720d25e12 cli: Get rid of clint, use Pygments
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-01-28 17:51:34 -08:00
Rohit Yadav
ad3692cbba cli: Add pygments based lexical output processing
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-01-28 17:48:49 -08:00
Rohit Yadav
59d01bfe20 cli: Show filter only when a subject is specified in autocompletion
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
(cherry picked from commit 7ea83b82e63bc40c5fa38f7aae2032690aa7883c)

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-01-28 16:31:12 -08:00
Rohit Yadav
6c527ffbba cli: Fix cachegen aand cloudmonkey to generate api verbs, revert last commit
Fixes cachegen and reverts "mvn: fix cloudmonkey build"

This reverts commit 6d3de41d4262abeedab234a08e8fb5714b69a9bf.
2013-01-27 04:18:31 -08:00
Prasanna Santhanam
6d3de41d42 mvn: fix cloudmonkey build
removing cachegen.py that is no longer required for execution

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-01-27 14:49:50 +05:30
Rohit Yadav
ddb794d960 cli: generate verbs on the fly, fix autocompletion whitespace bug
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-01-26 17:14:09 -08:00
Rohit Yadav
6f90a86b13 cli: fix cloudmonkey's pipe-ability
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-01-24 14:47:45 -08:00
Rohit Yadav
71257d6bb4 cli: give filter option only when output 'tabularized' is enabled
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-01-24 11:28:49 -08:00
Rohit Yadav
afb7e289fe cli: Fix development status to stable. cloudmonkey v1 at its most stable form
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-01-23 18:15:51 -08:00
Rohit Yadav
3c335bd883 cli: Fix asyncblock to search for correct key instead of hardcoded index
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-01-23 14:57:41 -08:00
Prasanna Santhanam
75b059e6e4 cloudmonkey: misses a couple of verbs for 'lock' and 'disassociate'
The following api commands have no cloudmonkey equivalent because
cloudmonkey grammar misses the related verbs.

~/tools/cli/cloudmonkey/marvin/cloudstackAPI(branch:master*) $ ls disassociateIpAddress.py
disassociateIpAddress.py

------------------------------------------------------------
~/tools/cli/cloudmonkey/marvin/cloudstackAPI(branch:master*) $ ls lock*
lockAccount.py lockUser.py
------------------------------------------------------------

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-01-23 16:05:41 +05:30
Rohit Yadav
c13f0199f4 cli: Cosmetic fix for prompt of cloudmonkey
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-01-06 17:30:00 -08:00
Rohit Yadav
f1c15f0c2e cli: Remove unused method, fix welcome msg, prompt
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-01-05 02:11:45 -08:00
Rohit Yadav
c7563cb7bd cli: Show progress during polling for async jobs
If asyncblock is set to true, prints dots as polling requests are made.
When result is obtained, dots are wiped and result is printed.

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-01-04 15:17:06 -08:00
Rohit Yadav
9a66beb658 CLOUDSTACK-717: Fix response json handling in cloudmonkey
- Fixes response handling
- Sorts alphabetically, count and id are on top if available
- Fix colors

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-01-04 15:17:06 -08:00
Rohit Yadav
503a5f2ccd cli: Get rid of deprecated sets, go functional, use filter()
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2012-12-21 11:21:22 -08:00
Rohit Yadav
13944a0e5e cli: Cosmetic fixes for cloudmonkey and setup.py dependency version fix
- Fixes shell class name to CloudMonkey
- Fixes prettyprint version req. to 0.6

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2012-12-20 16:34:36 -08:00
Rohit Yadav
8f51c630bd CLOUDSTACK-545: Tabularize cloudmonkey's response using filter=<fields,> argument
- Adds new cloudmonkey config field, tabularize
- If tabularize is set to true, all the list of dict in response are printed as
  table
- The columns of the tables can be filtered using the filter= argument, for ex:
  list domains listall=true filter=id,name,path
- filter arg will take comma separated values, if they have space put them under
  quotes
- Empty filter argument will cause it to print the whole table
- Multiple fields with the same name will cause it to print the column again
- In case there is a typo in the field, that column is skipped. It takes an
  intersection of response dict keys and filter keys provided
- Uses opensource prettytable library to pretty print tabular data

TODOs:
- Handle recursive table printing for nested list of dicts
- Colorize table columns if community wants such a feature

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2012-12-20 16:33:08 -08:00
Rohit Yadav
0f2a0950b6 cli: extract apicmd response using the apiname+response key
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2012-12-16 22:10:54 -08:00
Rohit Yadav
1551b982c4 cli: Handle command breaks, ctrl+c, don't break the shell
- Fix handles shell loop
- Handles any control breaks without breaking the shell
- Handles ctrl+c to start afresh on the shell

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2012-12-12 15:21:03 -08:00
Rohit Yadav
3e8655b580 cli: Handle badline http error
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2012-11-21 18:27:11 +05:30
Rohit Yadav
3b2e715888 cli: string fixes, use the major,minor version numbers same as CloudStack
<cloudstack major>.<cloudstack minor>.<cloudmonkey increment number>

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2012-11-20 14:56:34 +05:30
Rohit Yadav
5a2e15f67c CLOUDSTACK-522: Log requests in cloudmonkey's log
Patch fixes cloudmonkey to log requests in the log_file.
Summary:
  - Fixes logger
  - Fixes color print issue
  - Fixes welcome message
  - Makes code pep8 compliant

BUG-ID : CLOUDSTACK-522
Reviewed-by: Rohit Yadav <bhaisaab@apache.org>
Reported-by: Rohit Yadav

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2012-11-20 12:20:23 +05:30
Chip Childers
f7d2041056 Added exit as a cloudmonkey command, in addition to the existing quit command.
Signed-off-by: Chip Childers <chip.childers@gmail.com>
2012-11-19 14:39:58 -05:00
Chip Childers
311ef69a77 CLOUDSTACK-514: Added protocol and path support to cloudmonkey.
This is the second half of making cloudmonkey and marvin more
flexible in environments that may have https enabled and / or
a different path for the cloudstack API.

Signed-off-by: Chip Childers <chip.childers@gmail.com>
2012-11-19 14:24:10 -05:00
Rohit Yadav
1169464e35 cli: add exec rule to compute precache on mvn compile
Patch adds rules in maven to create precached file using cachegen

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2012-11-19 05:28:24 +05:30
Rohit Yadav
dc3c263d0f cli: move common code to common module
- Move config, grammar to common
- Cleanup cloudmonkey.py, import from common
- Import precached verbs, if fails init to {}

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2012-11-19 05:28:23 +05:30
Rohit Yadav
9070795be0 cli: precache generator
- Adds precache generator for all verbs in grammar
- ignore precache.py

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2012-11-19 05:28:23 +05:30
Rohit Yadav
7f08c9db57 cli: rename version to common
The idea is to refactor and put common code in common module

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2012-11-19 05:28:23 +05:30
Rohit Yadav
bbb2a56acb cli: refactoring, new grammar rules and command fixes
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2012-11-17 17:38:18 +05:30
Rohit Yadav
7ce53e89aa cli: make parse in posix mode
Posix mode allows the parse to:
- split by whitespace but value="between quotes are retained or enclose"
- quotes are stripped out

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2012-11-17 04:07:35 +05:30
Rohit Yadav
aa3ae45e6b CLOUDSTACK-499: Fix cloudmonkey's request and response methods
The old way of parsing involved complex object loading and traversing, in
new implementation json is used directly and authenticated requests via port
8080 making use of api and secret keys are recommended.

All args on shell are created in {"key": "value"} pairs which are used to create
url with &key=value. This way maps can be passed as args, example:

create networkoffering name=unique-name guestiptype=Isolated traffictype=GUEST
supportedservices=Dhcp,Dns serviceproviderlist[0].service=Dhcp
serviceproviderlist[0].provider=VirtualRouter serviceproviderlist[1].service=Dns
serviceproviderlist[1].provider=VirtualRouter

Added new conf variables:
- timeout: the no. of seconds after which an async job query timeouts
  default value of 3600 seconds
- asycnblock: if user wants their async commands to be tracked
  default value is 'true', if set to false, user can query using jobid which is
  returned by the async command and queried using:
     query asyncjobresult jobid=<jobid>

BUG-ID : CLOUDSTACK-499
Reviewed-by: Rohit Yadav <bhaisaab@apache.org>
Reported-by: Dave Cahill

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2012-11-16 22:18:32 +05:30
Rohit Yadav
08d16cf4d1 cli: Handle HTTP and URL errors
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2012-11-15 18:43:51 +05:30
Rohit Yadav
7ae8c4ad7e cli: Split using only space
Patch fixes lexical parser for default argument on shell.

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2012-11-15 18:43:51 +05:30
Rohit Yadav
c667eee570 cli: make commands pipe-able as on bash, on the shell
Makes commands pipe-able like bash.
Example while inside shell:
  > list virtualmachines | grep id
  > list accounts | more

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2012-11-08 12:35:20 +05:30
Rohit Yadav
8e64f34012 cli: autocomplete to assignment, adds syntactic sugar
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2012-11-07 18:34:23 +05:30
Rohit Yadav
5e293f422d cli: add maven plugin to delete copied marvin folder on fresh install
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2012-11-07 16:06:01 +05:30
Rohit Yadav
a5ad9c3c50 cli: fix keyerror in help doc handler
- Check and then print help docs
- Add verb configure

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2012-11-07 16:05:01 +05:30
Rohit Yadav
36e7a7884e cli: fix autocompletion binding bug, make all params lowercase
- fix weird autocompletion bug which won't let you enter the letter b [0]
- make set params, api and secret key vars lowercase
- use partition to get strings for do_set
- while installing, check and only then add readline (requires gcc and can fail)
- show monkey prompt by default, let users change if needed

[0] http://superuser.com/questions/297527/cant-type-the-b-letter-in-python-shell-in-os-x

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2012-11-06 19:41:07 +05:30
Rohit Yadav
ac8ae30658 cli: fix argument parsing for set command, fixes unicode monkey char
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2012-11-06 17:59:53 +05:30