The sort keys available in the list command should be the same, with or without --detail specified

Bug #1446450 reported by Kan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-ironicclient
Fix Released
Medium
Kan

Bug Description

The sort key used in the list command should be same no matter with or without detail argument.
For example:
kan@ubuntu-desk:~$ ironic port-list
+--------------------------------------+-------------------+
| UUID | Address |
+--------------------------------------+-------------------+
| a59a9644-5996-4ca5-b710-6edb2cf1cce5 | 52:54:00:d1:8b:81 |
| 7684010c-e7ac-49a0-9509-6b31aa3e056b | 52:54:00:1e:6b:00 |
| b65aebbb-eee5-435a-a4b2-58b9a9951fa1 | 52:54:00:64:3c:4c |
+--------------------------------------+-------------------+
kan@ubuntu-desk:~$ ironic port-list --detail
+--------------------------------------+-------------------+---------------------------+-------+--------------------------------------+------------+
| UUID | Address | Created At | Extra | Node UUID | Updated At |
+--------------------------------------+-------------------+---------------------------+-------+--------------------------------------+------------+
| a59a9644-5996-4ca5-b710-6edb2cf1cce5 | 52:54:00:d1:8b:81 | 2015-04-14T06:17:28+00:00 | {} | e0635505-85d9-428a-b4f1-d10a4eb31ff0 | None |
| 7684010c-e7ac-49a0-9509-6b31aa3e056b | 52:54:00:1e:6b:00 | 2015-04-14T06:17:29+00:00 | {} | ebc80789-6830-4240-90ad-58ddca2cae90 | None |
| b65aebbb-eee5-435a-a4b2-58b9a9951fa1 | 52:54:00:64:3c:4c | 2015-04-14T06:17:30+00:00 | {} | 714714bd-b4fc-4015-a15f-23d6f0cf09b1 | None |
+--------------------------------------+-------------------+---------------------------+-------+--------------------------------------+------------+
kan@ubuntu-desk:~$ ironic port-list --sort-key 'Created At'
Created At is an invalid field for sorting, valid values for --sort-key are: ['uuid', 'address', 'UUID', 'Address']
kan@ubuntu-desk:~$ ironic port-list --detail --sort-key 'Created At'
+--------------------------------------+-------------------+---------------------------+-------+--------------------------------------+------------+
| UUID | Address | Created At | Extra | Node UUID | Updated At |
+--------------------------------------+-------------------+---------------------------+-------+--------------------------------------+------------+
| a59a9644-5996-4ca5-b710-6edb2cf1cce5 | 52:54:00:d1:8b:81 | 2015-04-14T06:17:28+00:00 | {} | e0635505-85d9-428a-b4f1-d10a4eb31ff0 | None |
| 7684010c-e7ac-49a0-9509-6b31aa3e056b | 52:54:00:1e:6b:00 | 2015-04-14T06:17:29+00:00 | {} | ebc80789-6830-4240-90ad-58ddca2cae90 | None |
| b65aebbb-eee5-435a-a4b2-58b9a9951fa1 | 52:54:00:64:3c:4c | 2015-04-14T06:17:30+00:00 | {} | 714714bd-b4fc-4015-a15f-23d6f0cf09b1 | None |
+--------------------------------------+-------------------+---------------------------+-------+--------------------------------------+------------+

In DB:
mysql> desc ports;
+------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+-------------+------+-----+---------+----------------+
| created_at | datetime | YES | | NULL | |
| updated_at | datetime | YES | | NULL | |
| id | int(11) | NO | PRI | NULL | auto_increment |
| uuid | varchar(36) | YES | UNI | NULL | |
| address | varchar(18) | YES | UNI | NULL | |
| node_id | int(11) | YES | MUL | NULL | |
| extra | text | YES | | NULL | |
+------------+-------------+------+-----+---------+----------------+
7 rows in set (0.01 sec)

mysql> select * from ports order by created_at;
+---------------------+------------+----+--------------------------------------+-------------------+---------+-------+
| created_at | updated_at | id | uuid | address | node_id | extra |
+---------------------+------------+----+--------------------------------------+-------------------+---------+-------+
| 2015-04-14 06:17:28 | NULL | 1 | a59a9644-5996-4ca5-b710-6edb2cf1cce5 | 52:54:00:d1:8b:81 | 1 | {} |
| 2015-04-14 06:17:29 | NULL | 2 | 7684010c-e7ac-49a0-9509-6b31aa3e056b | 52:54:00:1e:6b:00 | 2 | {} |
| 2015-04-14 06:17:30 | NULL | 3 | b65aebbb-eee5-435a-a4b2-58b9a9951fa1 | 52:54:00:64:3c:4c | 3 | {} |
+---------------------+------------+----+--------------------------------------+-------------------+---------+-------+
3 rows in set (0.00 sec)

The 'created_at' is the column within the table 'ports', so it could be used as the sort key in list command, although it is not showed in the list command without detail argument.

The list command include: chassis, node, port.

Dmitry Tantsur (divius)
Changed in ironic:
status: New → Triaged
importance: Undecided → Medium
Changed in ironic:
assignee: nobody → Zhenguo Niu (niu-zglinux)
Changed in ironic:
assignee: Zhenguo Niu (niu-zglinux) → nobody
Revision history for this message
Zhenguo Niu (niu-zglinux) wrote :

seems should be addressed in ironicclient side.

Revision history for this message
Kan (kansks) wrote :

I think so. Remove affecting ironic for it is an ironicclient bug.

no longer affects: ironic
Changed in python-ironicclient:
assignee: nobody → Kan (kansks)
status: New → In Progress
Dmitry Tantsur (divius)
Changed in python-ironicclient:
importance: Undecided → Medium
Revision history for this message
Ruby Loo (rloo) wrote :

Kan, what's the status of this? It sez in progress -- is there a patch that fixes this?

summary: - The sort key used in the list command should be same no matter with or
- without detail argument
+ The sort keys available in the list command should be the same, with or
+ without --detail specified
Changed in python-ironicclient:
status: In Progress → Triaged
Revision history for this message
Ruby Loo (rloo) wrote :

I changed the status to 'Triaged' since I don't see a patch associated with this, and I may forget later to follow up. Kan, please update appropriately if you are working on it and if there is a patch. Thanks.

Revision history for this message
Kan (kansks) wrote :

Thanks Ruby. I have left for a period of time and come back now. Will propose patch asap. :)

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

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

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

Reviewed: https://review.openstack.org/236868
Committed: https://git.openstack.org/cgit/openstack/python-ironicclient/commit/?id=de50dfa2e1d371224021ccf5d7c767fb78a80d99
Submitter: Jenkins
Branch: master

commit de50dfa2e1d371224021ccf5d7c767fb78a80d99
Author: Kan <email address hidden>
Date: Mon Oct 19 08:59:34 2015 +0000

    Make sort keys the same for list commands

    The sort key used in the list command should be same
    no matter with or without detail command.

    The commands are:
     For chasis:
        chassis-list
        chassis-node-list
     For node:
        node-list
        node-port-list
     For port:
        port-list

    Change-Id: Idc4789618460c627d8ebe0070443585e261a73de
    Closes-Bug: #1446450

Changed in python-ironicclient:
status: In Progress → Fix Committed
Changed in python-ironicclient:
milestone: none → 1.0.0
status: Fix Committed → Fix Released
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.