incubator-cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rohit Yadav (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CLOUDSTACK-545) Tabularize the cloudmonkey response
Date Wed, 12 Dec 2012 23:59:21 GMT

    [ https://issues.apache.org/jira/browse/CLOUDSTACK-545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13530507#comment-13530507
] 

Rohit Yadav commented on CLOUDSTACK-545:
----------------------------------------

There are a lot of fields, printing them all in a table won't make sense, what I can implement
is something like a selector for every api (like we have in mysql), so you can select and
create the output view... example code that prints result as a table:

diff --git a/tools/cli/cloudmonkey/cloudmonkey.py b/tools/cli/cloudmonkey/cloudmonkey.py
index 8ceba4a..083f7f1 100644
--- a/tools/cli/cloudmonkey/cloudmonkey.py
+++ b/tools/cli/cloudmonkey/cloudmonkey.py
@@ -34,6 +34,7 @@ try:
 
     from clint.textui import colored
     from ConfigParser import ConfigParser, SafeConfigParser
+    from prettytable  import PrettyTable
     from urllib2 import HTTPError, URLError
     from httplib import BadStatusLine
 
@@ -169,6 +170,9 @@ class CloudStackShell(cmd.Cmd):
             return
 
         def print_result_as_dict(result):
+            printer = PrettyTable(result.keys())
+            printer.add_row(result.values())
+            print printer
             for key in result.keys():
                 if not (isinstance(result[key], list) or
                         isinstance(result[key], dict)):
                
> Tabularize the cloudmonkey response
> -----------------------------------
>
>                 Key: CLOUDSTACK-545
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-545
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the default.) 
>          Components: Cloudmonkey, Test Tools
>            Reporter: Prasanna Santhanam
>
> cloudmonkey responses would be more sensible and easier on the eye if they can look tabular
similar to the ec2 tools. enhance cloudmonkey to support tabular formatting instead of sequential
lists of the response

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message