Project

General

Profile

Bug #3504

Random column sorting from proxy list command

Added by Dominic Cleal over 6 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Category:
Hammer core
Target version:
Difficulty:
Triaged:
Bugzilla link:
Pull request:
Team Backlog:
Fixed in Releases:
Found in Releases:
In Kanboard:

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.

(https://bugzilla.redhat.com/show_bug.cgi?id=1023153)

Associated revisions

Revision 1b5e5048 (diff)
Added by Martin Bacovsky about 6 years ago

Fixed #3504 - Random column sorting on Ruby 1.8

Revision 9b898c2f
Added by mbacovsky about 6 years ago

Merge pull request #60 from mbacovsky/3504_random_column_sorting

Fixed #3504 - Random column sorting on Ruby 1.8

History

#1 Updated by Dominic Cleal over 6 years ago

  • Description updated (diff)

#2 Updated by Dmitri Dolguikh over 6 years ago

  • Target version set to 1.10.0

#3 Updated by Dmitri Dolguikh about 6 years ago

  • Target version changed from 1.10.0 to 1.9.3

#4 Updated by Hannes Schaller about 6 years ago

The ordering seems to affect the hostlist (if not all listings) as well ( http://pastebin.com/zJgSTzcK )
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

#5 Updated by Tomáš Strachota about 6 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.

#6 Updated by Dominic Cleal about 6 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...

#7 Updated by Martin Bacovsky about 6 years ago

  • Status changed from New to Assigned
  • Assignee set to Martin Bacovsky

#8 Updated by Martin Bacovsky about 6 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.

#9 Updated by Martin Bacovsky about 6 years ago

  • Status changed from Assigned to Ready For Testing

#10 Updated by Martin Bacovsky about 6 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

Applied in changeset foreman:hammer-cli|commit:1b5e5048908326e7abb8b96a100b9d635f67571a.

Also available in: Atom PDF