osc plugin event list sorting is hard to use
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,
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>]
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?)
Changed in python-heatclient: | |
assignee: | nobody → Jason Dunsmore (jasondunsmore) |
I'd suggest we do:
1. fix --sort :asc
2. document the sortable fields in "openstack stack event list --help"