useless 'u' in the return info of "openstack aggregate show"

Bug #1538006 reported by hgangwx
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Invalid
Undecided
Unassigned
python-novaclient
Invalid
Low
Pushkar
python-openstackclient
Triaged
Undecided
Unassigned

Bug Description

[Summary]
useless 'u' in the return info of "openstack aggregate show"

[Topo]
devstack all-in-one node

[Description and expect result]
no useless 'u' in the return info of "openstack aggregate show"

[Reproduceable or not]
reproduceable

[Recreate Steps]
1) useless 'u' for metadata when creating an aggregate:
root@45-59:/opt/stack/devstack# openstack aggregate create
--zone bbb --property abc=1 agg3
+-------------------+----------------------------------------------+
| Field | Value |
+-------------------+----------------------------------------------+
| availability_zone | bbb |
| created_at | 2016-01-26T11:07:16.000000 |
| deleted | False |
| deleted_at | None |
| hosts | [] |
| id | 3 |
| metadata | {u'abc': u'1', u'availability_zone': u'bbb'} |
| name | agg3 |
| updated_at | None |
+-------------------+----------------------------------------------+
root@45-59:/opt/stack/devstack#

2)useless 'u' for properties when show an aggregate:
root@45-59:/opt/stack/devstack# openstack aggregate show agg3
+-------------------+----------------------------+
| Field | Value |
+-------------------+----------------------------+
| availability_zone | bbb |
| created_at | 2016-01-26T11:07:16.000000 |
| deleted | False |
| deleted_at | None |
| hosts | [] |
| id | 3 |
| name | agg3 |
| properties | {u'abc': u'1'} |
| updated_at | None |
+-------------------+----------------------------+
root@45-59:/opt/stack/devstack#

3)useless 'u' for hosts when add host into an aggregate:
root@45-59:~# openstack aggregate add host agg3 45-59
+-------------------+----------------------------------------------+
| Field | Value |
+-------------------+----------------------------------------------+
| availability_zone | bbb |
| created_at | 2016-01-26T11:07:16.000000 |
| deleted | False |
| deleted_at | None |
| hosts | [u'45-59'] |
| id | 3 |
| metadata | {u'abc': u'1', u'availability_zone': u'bbb'} |
| name | agg3 |
| updated_at | None |
+-------------------+----------------------------------------------+
root@45-59:~#

[Configration]
reproduceable bug, no need

[logs]
reproduceable bug, no need

[Root cause anlyze or debug inf]
reproduceable bug

[Attachment]
None

Pallavi (p-pallavi)
Changed in nova:
assignee: nobody → Pallavi (p-pallavi)
Revision history for this message
Pallavi (p-pallavi) wrote :

Hi,

    I reproduced the bug as mentioned above and could see the 'u' in the output. On debugging, i find that while printing the aggregate data, if the value is a dict or list, it needs to be converted into Json format str.

    I made the below change in the file /usr/local/lib/python2.7/dist-packages/cliff/formatters/table.py such that if the value is dict or list then it is properly formatted and gets printed in the output.

     if isinstance(value, (dict, list)):
         value = jsonutils.dumps(value)

  Kindly let me know your comments on this.

Thanks & Regards,
Pallavi.

Changed in nova:
status: New → Confirmed
tags: added: api
Revision history for this message
Sean Dague (sdague) wrote :

Not a nova bug, this is completely in the display layer for novaclient

Changed in python-novaclient:
status: New → Confirmed
Changed in nova:
status: Confirmed → Invalid
tags: removed: api
Changed in python-novaclient:
importance: Undecided → Low
status: Confirmed → Triaged
tags: added: low-hanging-fruit
Pushkar (push7joshi)
Changed in python-novaclient:
assignee: nobody → Pushkar (push7joshi)
Revision history for this message
Neetu Jain (nutshi) wrote :

its in openstackclient not in novaclient

Changed in python-openstackclient:
status: New → Confirmed
Pushkar (push7joshi)
Changed in python-novaclient:
status: Triaged → Invalid
Changed in python-openstackclient:
assignee: nobody → Pushkar (push7joshi)
Pushkar (push7joshi)
Changed in python-openstackclient:
status: Confirmed → 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/281592

Pallavi (p-pallavi)
Changed in nova:
assignee: Pallavi (p-pallavi) → nobody
Revision history for this message
Steve Martinelli (stevemar) wrote :

Automatically unassigning due to inactivity.

Changed in python-openstackclient:
assignee: Pushkar (push7joshi) → nobody
status: In Progress → Triaged
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/493814

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

Change abandoned by Rui Chen (<email address hidden>) on branch: master
Review: https://review.openstack.org/445794
Reason: Recommit the patch on feature/osc4 branch, close this.

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

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

commit ff9bd34b3c63c22c96d7a0711939828a38f003d8
Author: Rui Chen <email address hidden>
Date: Fri Mar 10 17:32:44 2017 +0800

    [Compute]Make column content readable for both human and machine

    Currently, we use utils.format_dict(), utils.format_list(),
    utils.format_list_of_dicts to make column value can be easy to read by
    human, but osc support to format the CLI output into several format,
    like: json, shell, csv, yaml, most of these should be understand by
    program and code, so keeping the column content as the original value
    make sense, like {u'name': u'RuiChen'} than name='RuiChen'

    The patch include all compute commands.

    Change-Id: I313a52f94895625e6045df870320840fee157759
    Implements: blueprint osc-formattable-columns
    Partial-Bug: #1538015
    Partial-Bug: #1538006

tags: added: in-feature-osc4
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.