result should not be changed by column formatter when JSON/YAML format is specified

Bug #1524624 reported by Akihiro Motoki on 2015-12-10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Akihiro Motoki

Bug Description

neutron CLI support column formatters in ListCommand for better human readability. It work for the table formmater in cliff, but if we use JSON/YAML fomatters or others.

It requires extra special parsing when we want to use the output in JSON/YAML format.

It affects commands which use the table formatter, ShowCommand, CreateCommand, ListCommand.

Fix proposed to branch: master

Changed in python-neutronclient:
status: New → In Progress
Akihiro Motoki (amotoki) wrote :

In neutronclient we decided not to

/FYI/ cliff-tablib 2.0 was released which drops duplicated formatters.
If folks install latest version of cliff and cliff-tablib, the combination of cliff >=1.15.0 and cliff-tablib >= 2.0 will solve the issue.

Regarding the difference between two JSON formatters, JSON formamters from cliff looks better
and it is the right direction we should go.

Changed in python-neutronclient:
status: In Progress → Won't Fix
Changed in python-neutronclient:
status: Won't Fix → In Progress

Submitter: Jenkins
Branch: master

commit 7bf8f229bba9762b188ae3517b9ef810269c671e
Author: Akihiro Motoki <email address hidden>
Date: Thu Dec 10 04:57:11 2015 +0900

    Use raw values when non-table formatter is used

    neutron CLI supports various output formats such as json, yaml
    (e.g. neutron net-list -f json),
    but the current output formattings is optimized to the table
    formatter to get human-friendly output in normal CLI use
    (For example, new lines are inserted).
    However, this kind of formatting is unnecessary when other output
    formatters are used and prevents users from getting proper data.

    This commit changes to skip format_output_data() method when
    output formatters other than 'table' are used.
    Now we have proper outputs in JSON, YAML or other formats.

    In CreateCommand and ShowCommand, cleanup_output_data() is moved
    to each command class because it should be called regardless of
    a formatter type.

    In ListCommand, value formatter for CSV is still supported for backward
    compatiblity, but the value formatter for fixed_ips of the port resource
    is removed because it brings no much value in CSV output.

    Closes-Bug: #1524624
    Change-Id: I2668fa90402d7119db69f09a20fb7c7270c9616e

Changed in python-neutronclient:
status: In Progress → Fix Released

This issue was fixed in the openstack/python-neutronclient 6.1.0 release.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers