90 Commits

Author SHA1 Message Date
Rohit Yadav
6f84e74a68 tools: Remove cloudmonkey, add info in INSTALL.md
After some discussion on the dev ML[1], we decided to move tools/cli which
contained cloudmonkey to a new git repository [2]. We did that by retaining
its history. In this commit, we remove tools/cli and add information on where
to find cloudmonkey. This is help us speed up cloudmonkey's development and
releases, now that with ApiDiscovery it's completely independent of any other
CloudStack modules.

[1] http://markmail.org/message/tjlr753xfhpw4uk4
[2] https://git-wip-us.apache.org/repos/asf?p=cloudstack-cloudmonkey.git

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-07-28 22:53:12 +05:30
Rohit Yadav
10f9516015 cloumonkey: Remove junk from requester.py
This fix removes junk from 6e22843acb6bbd61260849fac171bba61ac6650f which was
supposed to just improve error messages and not messup the whole async block
logic and go into an infinite recursion or fail with some key error.

Signed-off-by: Rohit Yadav <rohit.yadav@wingify.com>
2013-06-16 18:34:32 +05:30
Rohit Yadav
1a058d7793 cloudmonkey: Bump up version of cloudmonkey to 4.2.xx
Signed-off-by: Rohit Yadav <rohit.yadav@wingify.com>
2013-06-16 18:33:34 +05:30
Rohit Yadav
056e8fb533 cli: Make cachemaker.py pep8 compliant
Fixes object comparision to use a "is" b instead of ==

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-05-25 20:32:10 +05:30
Rohit Yadav
7bff1d08f4 CLOUDSTACK-2020: Make cli's requester unicode friendly
Fixed list processing that uses lambdas to use x.lower() assuming x is string,
and not forced/caster str.lower(obj)

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-04-16 10:41:21 +05:30
Rohit Yadav
ff74cbbeea cli: Remove tabularize, fix display types, make code pep8 compliant
- Remove tabularize field
- Now display types are: default, json and table
- Make requester pep8 compliant
- Remove unnecessary comments, if we want them we should put them on each method

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-04-05 23:06:44 +05:30
Rohit Yadav
9fbae85799 cli: Make cloudmonkey.py pep8 compliant
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-04-05 22:56:07 +05:30
Justin Grudzien
c75b11d13a CLOUDSTACK-1875: add JSON output to cloudmonkey
Added
1. display = [default|json|tabularize] has been added in the config to replace tabularize = [true|false]
2. tabularize is deprecated but we will still set it as "false" once the user removes it out of their config to avoid throwing an error. This will be removed in the next major version.
3. display = "default" is added to the [ui] section of the config if it is not present.
4. You can now output JSON formatted text by setting the config display = json
5. You can now filter text in JSON output mode. (i.e. list users account=grudzien filter=account,id,email). Filtered output returns a properly formatted JSON document.

Removed
1. Removed the printing of attr keys in read_config().

Deprecated
1. tabularize = [true|false] is now messaged as deprecated.

Signed-off-by: Justin Grudzien <grudzien@gmail.com>
2013-04-05 22:48:15 +05:30
Rohit Yadav
63fa086fcc cli: Handle URLError, variable refactor used passed variable
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-04-05 22:42:55 +05:30
Funs Kessen
6e22843acb Cloudmonkey requester.py change to return clearer errors and implement a logic change for async calls.
Applied from review request:
https://reviews.apache.org/r/10151/

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-04-05 22:42:55 +05:30
Rohit Yadav
ccba1c728c cli: Make cloudmonkey use new url and dev ml
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-03-26 11:25:26 +05:30
Rohit Yadav
0d62549d61 cli: Run onecmd if any arg is passed
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-03-20 13:14:09 +05:30
Rohit Yadav
4ad5d1a4f5 cli: Fix nonetype issue with cachemaker and exit after printing version
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-03-20 12:42:29 +05:30
Rohit Yadav
0b7a4e04aa cli: Check args from optparser and not sys.argv
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-03-19 18:04:52 +05:30
Rohit Yadav
19a290500e cli: Import project info from config in setup.py, fix debug msgs
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>

lsdfjk

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-03-19 16:05:11 +05:30
Rohit Yadav
4421f2bb60 CLOUDSTACK-1708: Let cloudmonkey accept cfg passed in cmd line
The patch adds feature in cloudmonkey to have multiple profiles by passing
custom cfg file to set custom profile in both interactive shell and cmd line tool
use cases.

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-03-19 16:05:11 +05:30
Rohit Yadav
e28aa09f01 cli: cachemaker should import config and not the field
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-03-19 16:05:11 +05:30
Rohit Yadav
93bc669a0e cli: Pass config file by value in cloudmonkey's config
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-03-19 16:05:10 +05:30
Rohit Yadav
cc9b7d4c20 cloudmonkey: print sync stats, asks users to use sync
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-03-06 17:21:32 +05:30
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