Output should be machine-readable when JSON/YAML formatter is specified

Bug #1687955 reported by Akihiro Motoki
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
python-neutronclient
Fix Released
Medium
Akihiro Motoki
python-openstackclient
Fix Released
Undecided
Akihiro Motoki

Bug Description

OSC commands convert complex fields into human-readable strings by using formatters, but the conversion is made even for machine readable formats like json and yaml.

The following is an example of the output of "openstack subnet list --format json --long"
http://paste.openstack.org/show/608702/

Allocation Pools and Host Routes are a list of dict. DNS Servers is a list.
They should be output if a machine readable format is requested.

cliff has a concept of FormattableColumn [1] and OSC can be improved by using FormattableColumn.
http://git.openstack.org/cgit/openstack/cliff/tree/cliff/columns.py

Akihiro Motoki (amotoki)
Changed in python-openstackclient:
assignee: nobody → Akihiro Motoki (amotoki)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to osc-lib (master)

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

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

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

Revision history for this message
Rui Chen (kiwik-chenrui) wrote :

This is the reference implement about compute commands https://review.openstack.org/#/c/445794/ , we can use the bug to trace the process until we finish all related commands.

Revision history for this message
Akihiro Motoki (amotoki) wrote :

Thanks Rui, I was not aware of your patch of introducing the formattable columns. I agree to use this bug to track the effort.

Revision history for this message
Akihiro Motoki (amotoki) wrote :

neutron OSC plugin is affected.

Changed in python-neutronclient:
assignee: nobody → Akihiro Motoki (amotoki)
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-neutronclient (master)

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

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

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-neutronclient (master)

Reviewed: https://review.openstack.org/464343
Committed: https://git.openstack.org/cgit/openstack/python-neutronclient/commit/?id=e40669237b1972e90d448001933644ae1d0c835c
Submitter: Jenkins
Branch: master

commit e40669237b1972e90d448001933644ae1d0c835c
Author: Akihiro Motoki <email address hidden>
Date: Sun May 14 19:33:03 2017 +0000

    Machine-readable output for JSON/YAML format

    Currently even if machine-readable format like JSON or YAML is specified,
    formatted output is displayed. When machine-readable format is used,
    they should not be converted by formatters.

    Change-Id: I5f1e90ff60f30380106e1aa730f96a1f72c7a166
    Closes-Bug: #1687955

Changed in python-neutronclient:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-neutronclient 6.3.0

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to osc-lib (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/479463

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to osc-lib (master)

Reviewed: https://review.openstack.org/479463
Committed: https://git.openstack.org/cgit/openstack/osc-lib/commit/?id=596af360fb43cc20ad634834af34ff5a0919743c
Submitter: Jenkins
Branch: master

commit 596af360fb43cc20ad634834af34ff5a0919743c
Author: Akihiro Motoki <email address hidden>
Date: Sat Jul 1 14:44:56 2017 +0900

    Add test methods to compare formattable column values

    When formattable columns are used we cannot compare two items
    just using assertEqual(item1, item2). We need to compare
    two items column by column calling human_readable or
    machine_readable methods.

    This commit add convenient assert methods to encourage
    the usage of cliff formattable columns in OSC.

    An example of the usage of the new methods is found at:
    https://review.openstack.org/#/c/462170/ or related reviews.

    Related-Bug: #1687955
    Related to blueprint osc-formattable-columns

    Change-Id: Ib801f6204e7a694c597d93a3a6d40dc500212f65

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/462150
Committed: https://git.openstack.org/cgit/openstack/osc-lib/commit/?id=8cbdcde6076fa1df40e00d3e16bf140a59aa6273
Submitter: Jenkins
Branch: master

commit 8cbdcde6076fa1df40e00d3e16bf140a59aa6273
Author: Akihiro Motoki <email address hidden>
Date: Wed May 3 12:52:09 2017 +0000

    Emit warnings to encourage cliff FormattableColumn

    cliff has a concept of FormattableColumn which allows CLI implementors
    to convert data into human-readable format only when a human-readable
    format is requested and keep data unconverted for manchine-readable
    formats like JSON or YAML.

    Deprecation warnings is now emitted in favor of using FormattableColumn.

    Partially implement blueprint osc-formattable-columns
    Change-Id: Ia55bc950ecfc666d4a957507beab98eef74390aa
    Related-Bug: #1687955

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-openstackclient (feature/osc4)

Fix proposed to branch: feature/osc4
Review: https://review.openstack.org/494181

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: feature/osc4
Review: https://review.openstack.org/494182

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: feature/osc4
Review: https://review.openstack.org/494183

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: feature/osc4
Review: https://review.openstack.org/494184

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: feature/osc4
Review: https://review.openstack.org/494185

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: feature/osc4
Review: https://review.openstack.org/494186

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on python-openstackclient (master)

Change abandoned by Akihiro Motoki (<email address hidden>) on branch: master
Review: https://review.openstack.org/464641
Reason: This change should go to feature/osc4 branch

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by Akihiro Motoki (<email address hidden>) on branch: master
Review: https://review.openstack.org/464640
Reason: This change should go to feature/osc4 branch

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by Akihiro Motoki (<email address hidden>) on branch: master
Review: https://review.openstack.org/462170
Reason: This change should go to feature/osc4 branch

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by Akihiro Motoki (<email address hidden>) on branch: master
Review: https://review.openstack.org/464638
Reason: This change should go to feature/osc4 branch

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by Akihiro Motoki (<email address hidden>) on branch: master
Review: https://review.openstack.org/464637
Reason: This change should go to feature/osc4 branch

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by Akihiro Motoki (<email address hidden>) on branch: master
Review: https://review.openstack.org/464639
Reason: This change should go to feature/osc4 branch

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-openstackclient (feature/osc4)

Reviewed: https://review.openstack.org/494181
Committed: https://git.openstack.org/cgit/openstack/python-openstackclient/commit/?id=07f5498842834823ec911811e6e9c8ba9ff4ac9b
Submitter: Jenkins
Branch: feature/osc4

commit 07f5498842834823ec911811e6e9c8ba9ff4ac9b
Author: Akihiro Motoki <email address hidden>
Date: Wed May 3 14:19:27 2017 +0000

    Use cliff formattable columns in network commands

    Use cliff formattable columns not to convert complex fields
    into a string when a machine readable format like JSON or YAML
    is requested.

    Partial-Bug: #1687955
    Partially implement blueprint osc-formattable-columns
    Change-Id: If478fccd867a4bcd7c86e283c5aaf67a667cc080

tags: added: in-feature-osc4
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/494182
Committed: https://git.openstack.org/cgit/openstack/python-openstackclient/commit/?id=8e6772c36fdb99ca763d08eb2d91699376b4807f
Submitter: Jenkins
Branch: feature/osc4

commit 8e6772c36fdb99ca763d08eb2d91699376b4807f
Author: Akihiro Motoki <email address hidden>
Date: Mon May 15 04:00:53 2017 +0000

    Use cliff formattable columns in image commands

    Related functional tests are converted into JSON format.
    Otherwise, it is not easy to check results.

    Partial-Bug: #1687955
    Partially implement blueprint osc-formattable-columns
    Change-Id: I682e67be24372c0de145f8db20911b13530ae6c6

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/494183
Committed: https://git.openstack.org/cgit/openstack/python-openstackclient/commit/?id=af9eb9ca83c6a1ee66d8e368719c36c0e7ee4024
Submitter: Jenkins
Branch: feature/osc4

commit af9eb9ca83c6a1ee66d8e368719c36c0e7ee4024
Author: Akihiro Motoki <email address hidden>
Date: Mon May 15 07:55:41 2017 +0000

    Use cliff formattable columns in volume v1 commands

    Partial-Bug: #1687955
    Partially implement blueprint osc-formattable-columns
    Change-Id: Icd8345b7364029f35971d12d0dc90db2e4018186

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/494186
Committed: https://git.openstack.org/cgit/openstack/python-openstackclient/commit/?id=6364b7b81f362f8f4bde85d973b2c36c70bc4db2
Submitter: Jenkins
Branch: feature/osc4

commit 6364b7b81f362f8f4bde85d973b2c36c70bc4db2
Author: Akihiro Motoki <email address hidden>
Date: Mon May 15 04:00:32 2017 +0000

    Use cliff formattable columns in identity commands

    Partial-Bug: #1687955
    Partially implement blueprint osc-formattable-columns
    Change-Id: I3f85129460ebeb177f5fdb30995bc1dcdf28c774

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/494184
Committed: https://git.openstack.org/cgit/openstack/python-openstackclient/commit/?id=b0dc1aa931f9d801eb0ecdc998beb13fb8fc8653
Submitter: Jenkins
Branch: feature/osc4

commit b0dc1aa931f9d801eb0ecdc998beb13fb8fc8653
Author: Akihiro Motoki <email address hidden>
Date: Mon May 15 10:19:07 2017 +0000

    Use cliff formattable columns in volume v2 commands

    Partial-Bug: #1687955
    Partially implement blueprint osc-formattable-columns
    Change-Id: I8bfb95c7b1a891de00978118b80cc8d81c6729bd

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/494185
Committed: https://git.openstack.org/cgit/openstack/python-openstackclient/commit/?id=e0c86250e9ed10909ba2984472088dabf8acf961
Submitter: Jenkins
Branch: feature/osc4

commit e0c86250e9ed10909ba2984472088dabf8acf961
Author: Akihiro Motoki <email address hidden>
Date: Mon May 15 04:01:07 2017 +0000

    Use cliff formattable columns in object storage commands

    Partial-Bug: #1687955
    Partially implement blueprint osc-formattable-columns
    Change-Id: I1d4e0f010fc89729c832d0422d023723c00f49fe

Revision history for this message
Akihiro Motoki (amotoki) wrote :

The work has been completed in feature/osc4 branch.

Changed in python-openstackclient:
status: In Progress → Fix Released
Revision history for this message
Artem Goncharov (gtema) wrote :

What are the following actions here? Would osc4 branch be merged into master?
Those warnings are really annoying.

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

Duplicates of this bug

Other bug subscribers

Remote bug watches

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