Bug #3504
closedRandom column sorting from proxy list command
Description
Description of problem:
run 'proxy list' and get a random sort by column
Steps to Reproduce:
1. run 'hammer -u admin -p admin proxy list' three times in a row and see what happens.
Actual results:
[root@cloud-qe-21 ~]# hammer -u admin -p admin proxy list -------------------------------------------------------------------- NAME | ID | URL -------------------------------------------------------------------- cloud-qe-21.idm.lab.bos.red... | 1 | https://cloud-qe-21.idm.lab... lenovo-rd230-01.lab.bos.red... | 2 | https://lenovo-rd230-01.lab... mgmt2.rhq.lab.eng.bos.redha... | 4 | https://mgmt2.rhq.lab.eng.b... -------------------------------------------------------------------- [root@cloud-qe-21 ~]# hammer -u admin -p admin proxy list -------------------------------------------------------------------- NAME | URL | ID -------------------------------------------------------------------- cloud-qe-21.idm.lab.bos.red... | https://cloud-qe-21.idm.lab... | 1 lenovo-rd230-01.lab.bos.red... | https://lenovo-rd230-01.lab... | 2 mgmt2.rhq.lab.eng.bos.redha... | https://mgmt2.rhq.lab.eng.b... | 4 -------------------------------------------------------------------- [root@cloud-qe-21 ~]# hammer -u admin -p admin proxy list -------------------------------------------------------------------- ID | URL | NAME -------------------------------------------------------------------- 1 | https://cloud-qe-21.idm.lab... | cloud-qe-21.idm.lab.bos.red... 2 | https://lenovo-rd230-01.lab... | lenovo-rd230-01.lab.bos.red... 4 | https://mgmt2.rhq.lab.eng.b... | mgmt2.rhq.lab.eng.bos.redha... --------------------------------------------------------------------
Expected results:
Some standard sort, probably by ID, I guess. An option to let user provide a sort key down the road might be nice, but at very least we should be providing results in the same manner each time.
Updated by Hannes Schaller over 11 years ago
Using
- rubygem-table_print-1.1.5-3.el6.noarch
- rubygem-hammer_cli-0.0.12-1.el6.noarch
- rubygem-hammer_cli_foreman-0.0.12-1.el6.noarch
Updated by Tomáš Strachota over 11 years ago
I couldn't reproduce the problem with the latest table_print.
rubygem-table_print-1.1.5-3.el6.noarch on ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux] seems to be affected.
Updated by Dominic Cleal over 11 years ago
Another guess is that Ruby 1.8's hashes can have a "random" iteration order, while it's more deterministic on 1.9...
Updated by Martin Bacovsky over 11 years ago
This is known problem with table_print gem https://github.com/arches/table_print/issues/43.
After a couple of hours of debugging I gave up. Inside table_print the columns are passed through several hashes which do not keep order in Ruby 1.8. It seems it will not be trivial to fix it. I'll check with table_print author what options we have and will try to find some workaround in the meantime.
Updated by Martin Bacovsky over 11 years ago
- Status changed from Assigned to Ready For Testing
Updated by Martin Bacovsky over 11 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset foreman:hammer-cli|commit:1b5e5048908326e7abb8b96a100b9d635f67571a.