osc plugin event list sorting is hard to use

Bug #1599568 reported by Steven Hardy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-heatclient
Fix Released
Medium
Jason Dunsmore

Bug Description

I noticed that the old heat CLI doesn't support event sort order, so I tried to use the osc interface instead, and it's not intuitive unless you dig into the details of the event payload:

[stack@instack ~]$ openstack stack event list overcloud --sort asc
Resource doesn't have field asc

[stack@instack ~]$ openstack stack event list overcloud --sort desc
Resource doesn't have field desc

[stack@instack ~]$ openstack stack event list overcloud --sort
usage: openstack stack event list [-h] [-f {csv,json,log,table,value,yaml}]
                                  [-c COLUMN] [--noindent]
                                  [--max-width <integer>]
                                  [--quote {all,minimal,none,nonnumeric}]
                                  [--resource <resource>]
                                  [--filter <key=value>] [--limit <limit>]
                                  [--marker <id>] [--nested-depth <depth>]
                                  [--sort <key>[:<direction>]] [--follow]
                                  <stack>
openstack stack event list: error: argument --sort: expected one argument

So, none of the usage errors actually tell you what the format should be, only that "Resource doesn't have field", which means nothing to users.

Looking at the help also doesn't solve the problem:

[stack@instack ~]$ openstack stack event list overcloud --help
<snip>
  --sort <key>[:<direction>]
                        Sort output by selected keys and directions (asc or
                        desc) (default: asc). Specify multiple times to sort
                        on multiple keys

Ok, so I'm supposed to specify a sort key (referred to as field above), but I still don't know what it is, and all I want to do is reverse the default order (which is sorted by time), lets try omitting the key and just specifying the direction:

[stack@instack ~]$ openstack stack event list overcloud --sort :asc
empty string is not a valid sort key

Nope, fail! Eventually I gave in and ran --debug so I could grab the field, which is event_time. I persevered with the non-debug approach though to see what it would be like for non developer users (pretty difficult AFAICT!).

[stack@instack ~]$ openstack stack event list overcloud --sort event_time:asc

I think we should probably do some/both of:

1. Enable passing no sort key, it should be possible to just pass the direction to the underlying API I think

2. Present a list of valid sort keys in the usage when none is passed (perhaps by just getting one event the grabbing all the keys?)

Revision history for this message
Steve Baker (steve-stevebaker) wrote :

I'd suggest we do:

1. fix --sort :asc
2. document the sortable fields in "openstack stack event list --help"

Changed in python-heatclient:
status: New → Triaged
assignee: nobody → Steve Baker (steve-stevebaker)
importance: Undecided → Medium
assignee: Steve Baker (steve-stevebaker) → nobody
Changed in python-heatclient:
assignee: nobody → Jason Dunsmore (jasondunsmore)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-heatclient (master)

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

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

Reviewed: https://review.openstack.org/378773
Committed: https://git.openstack.org/cgit/openstack/python-heatclient/commit/?id=988824784b4dfbc8a941d0374dbaa253104966fd
Submitter: Jenkins
Branch: master

commit 988824784b4dfbc8a941d0374dbaa253104966fd
Author: Jason Dunsmore <email address hidden>
Date: Tue Sep 27 15:16:59 2016 -0500

    Use event_time as default event sort key in OSC

    Closes-Bug: #1599568
    Change-Id: Id1e6e7669b03f5dd4a66a1e786a08eb9ade79307

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

This issue was fixed in the openstack/python-heatclient 1.6.0 release.

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.