'server list --sort-column Networks' exits with 'list index out of range'
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| cliff |
Fix Committed
|
Undecided
|
Matthias Harzer | ||
| python-openstackclient |
In Progress
|
Undecided
|
Udayendu Kar | ||
Bug Description
When trying to sort servers by their networks using
openstack server list --sort-column Networks
the command exits with a message 'list index out of range' (no table being printed). Other sort columns work as expected, only the 'Networks' column seem to cause this behavior.
When using the `--debug` flag, it reveals that this issue seems to lay in the 'cliff' package, which incorrectly handles a prior error. During sorting, cliff tries to compare values from the 'Networks' column, which seem to be incomparable. This raises an error. In case of such failure, ordering should be skipped (ordering is best effort), but during recovery, cliff fails again (this time with the out of range error) while trying to log the compare-error [1].
The index out of range error is due to the wrong array being used ('parsed_
Although fixing this in cliff would prevent this error, it would still not sort the columns as requested, which may be another issue.
[1] https:/
[2] https:/
| Changed in python-openstackclient: | |
| assignee: | nobody → Joonseok Kim (lylekim) |
| assignee: | Joonseok Kim (lylekim) → nobody |
| affects: | python-openstackclient → cliff |
| affects: | cliff → python-cliff |
| Changed in python-cliff: | |
| status: | In Progress → Fix Committed |
| Changed in python-cliff: | |
| status: | Fix Committed → In Progress |
| Changed in python-cliff: | |
| assignee: | nobody → Matthias Harzer (matthiasharzer) |
| status: | New → Fix Committed |
Hi Matthias, I was able to reproduce the issue and given a patch: https:/ /review. opendev. org/c/openstack /cliff/ +/995202
Now its able to sort the Networks field properly. Please try once and let me know. The issue was with cliff package.
With this fix, the output is going to be like:
(kolla-venv) root@uskar- dev-node: ~# openstack server list ------- ------- ------- ------- ----+-- ------- -+----- ---+--- ------- ------- ------- +------ --+---- -----+ ------- ------- ------- ------- ----+-- ------- -+----- ---+--- ------- ------- ------- +------ --+---- -----+ dfe3-48ce- b5fa-9974f167d0 3c | server-5 | ACTIVE | demo-net=10.0.0.144 | cirros | m1.tiny | 7c15-42e9- b73f-1d1db2a7c9 77 | server-4 | ACTIVE | network4= 192.168. 4.222 | cirros | m1.tiny | a010-4334- 84d0-761b8f614d 92 | server-3 | ACTIVE | network3= 192.168. 3.128 | cirros | m1.tiny | 26a7-4cac- 8d09-920d076c73 1f | server-1 | ACTIVE | network1= 192.168. 1.254 | cirros | m1.tiny | ------- ------- ------- ------- ----+-- ------- -+----- ---+--- ------- ------- ------- +------ --+---- -----+ dev-node: ~# openstack server list --sort-column ID ------- ------- ------- ------- ----+-- ------- -+----- ---+--- ------- ------- ------- +------ --+---- -----+ ------- ------- ------- ------- ----+-- ------- -+----- ---+--- ------- ------- ------- +------ --+---- -----+ 26a7-4cac- 8d09-920d076c73 1f | server-1 | ACTIVE | network1= 192.168. 1.254 | cirros | m1.tiny | 7c15-42e9- b73f-1d1db2a7c9 77 | server-4 | ACTIVE | network4= 192.168. 4.222 | cirros | m1.tiny | a010-4334- 84d0-761b8f614d 92 | server-3 | ACTIVE | network3= 192.168. 3.128 | cirros | m1.tiny | dfe3-48ce- b5fa-9974f167d0 3c | server-5 | ACTIVE | demo-net=10.0.0.144 | cirros | m1.tiny | ------- ------- ------- ------- ----+-- ------- -+----- ---+--- ------- ------- ------- +------ --+---- -----+ dev-node: ~# openstack server list --sort-column Name ------- ------- ------- ------- ----+-- ------- -+----- ---+--- ------- ------- ------- +------ --+---- -----+ ------- ------- ------- ------- ----+-- ------- -+----- ---+--- ------- ------- ------- +------ --+---- -----+ 26a7-4cac- 8d09-920d076c73 1f | server-1 | ACTIVE | network1= 192.168. 1.254 | cirros | m1.tiny | a010-4334- 84d0-761b8f614d 92 | server-3 | ACTIVE | network3= 192.168. 3.128 | cirros | m1.tiny | 7c15-42e9- b73f-1d1db2a7c9 77 | server-4 | ACTIVE | network4= 192.168. 4.222 | cirros | m1.tiny | dfe3-48ce- b5fa-9974f167d0 3c | server-5 | ACTIVE | demo-net=10.0.0.144 | cirros | m1.tiny | ------- ------- ------- ------- ----+-- ------- -+----- ---+--- ------- ------- ------- +------ --+---- -----+ dev-node: ~# openstack server list --sort-column Networks ------- ------- ------- ------- ----+-- ------- -+----- ---+--- ------- ------- ------- +------ --+---- ----...
+------
| ID | Name | Status | Networks | Image | Flavor |
+------
| f40c37eb-
| 56c7a2f4-
| 967b89ed-
| 235c0e33-
+------
(kolla-venv) root@uskar-
+------
| ID | Name | Status | Networks | Image | Flavor |
+------
| 235c0e33-
| 56c7a2f4-
| 967b89ed-
| f40c37eb-
+------
(kolla-venv) root@uskar-
+------
| ID | Name | Status | Networks | Image | Flavor |
+------
| 235c0e33-
| 967b89ed-
| 56c7a2f4-
| f40c37eb-
+------
(kolla-venv) root@uskar-
+------