sort options - -sort-key and - -sort-dir doesn't work in " manila list " command.
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
python-manilaclient |
Fix Released
|
Medium
|
Deepak Mourya |
Bug Description
python-manilaclient version is 1.23.0
Problem:
When I use "manila list --sort-key name --sort-dir asc" command to sort the queried shares, sort options --sort-key and --sort-dir are not working. I have tried to sort by name but the list is always the same and sorted only according to ID.
Analyse:
The do_list() method in manilaclient/
manilaclient/
-----
@cliutils.
def do_list(cs, args):
...
cliutils.
-----
and the definition of print_list()method is as below:
manilaclient/
-----
def print_list(objs, fields, formatters=None, sortby_index=0,
"""Print a list or objects as a table, one row per object.
:param objs: iterable of :class:`Resource`
:param fields: attributes that correspond to columns, in order
:param formatters: `dict` of callables for field formatting
:param sortby_index: index of the field for sorting table rows
:param mixed_case_fields: fields corresponding to object attributes that
have mixed case names (e.g., 'serverId')
:param field_labels: Labels to use in the heading of the table, default to
fields.
"""
...
if sortby_index is None:
kwargs = {}
else:
kwargs = {'sortby': field_labels[
pt = prettytable.
pt.align = 'l'
....
if six.PY3:
else:
-----
so the the value of sortby_index will fixed to 0, and the value of variable kwargs will fixed to "{'sortby': 'ID'}".
Changed in python-manilaclient (Ubuntu): | |
assignee: | nobody → Huabang Ding (dinghb) |
Changed in python-manilaclient: | |
assignee: | nobody → Deepak Mourya (mourya007) |
Changed in python-manilaclient: | |
importance: | Undecided → Medium |
milestone: | none → rocky-3 |
no longer affects: | python-manilaclient (Ubuntu) |
This appears to affect the upstream project as well as the Ubuntu package. I've targeted this at upstream python-manilaclient as well.