Allow arbitrary formatting of attributes on CLI

Bug #1213056 reported by Jiří Stránský
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-tuskarclient
Fix Released
High
Jiří Stránský

Bug Description

Currently our formatter for printing resources' attributes can't deal with more complex data, e.g. JSON arrays like `Rack.nodes`. The resulting output on CLI is far from pretty and breaks table formatting. We need a way to format attributes arbitrarily for printing.

Also, we want to have the same formatting algorithms for printing lists and for printing details. In the current codebase (taken from Ceilometer client) they're not very similar.

Changed in python-tuskarclient:
importance: Undecided → High
assignee: nobody → Jiří Stránský (jistr)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-tuskarclient (master)

Fix proposed to branch: master
Review: https://review.openstack.org/43127

Changed in python-tuskarclient:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-tuskarclient (master)

Reviewed: https://review.openstack.org/43127
Committed: http://github.com/stackforge/python-tuskarclient/commit/ca01366beaa75f66d68cc4023691d886f180c086
Submitter: Jenkins
Branch: master

commit ca01366beaa75f66d68cc4023691d886f180c086
Author: Jiri Stransky <email address hidden>
Date: Mon Aug 19 15:48:37 2013 +0200

    Advanced print formatting for CLI

    Modelled mostly after how Heat does it, but with some added power and
    also consistency between print_list and print_dict.

    We have print_list for printing of lists and print_dict for printing
    of show actions. Both functions take as arguments (aside from the data
    to print) also an optional dict of custom formatters (allowing to
    freely format the attributes before printing) and custom labels
    (allowing to tweak table headers and property names). The list is also
    sorted by one of the columns.

    The formatting is showcased on sample formatters and actions -
    rack-show and rack-list.

    Fixes bug 1213056

    Change-Id: Ic14dbb930a5967e2634c1b4777e6705ab2a370ec

Changed in python-tuskarclient:
status: In Progress → Fix Committed
Changed in python-tuskarclient:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.