- 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>
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>
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>
- 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>
- 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>
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>
- 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>
- 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>
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>
- 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>
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>
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>
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>
- 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>
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 <bhaisaab@apache.org>
- autocompletions for help docs
- more verbose doc strings with __doc__ import from the module and list of
required args and all args
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>