Project

General

Profile

Actions

Bug #3504

closed

Random column sorting from proxy list command

Added by Dominic Cleal over 10 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Category:
Hammer core
Target version:
Difficulty:
Triaged:
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)

Actions #1

Updated by Dominic Cleal over 10 years ago

  • Description updated (diff)
Actions #2

Updated by Anonymous over 10 years ago

  • Target version set to 1.10.0
Actions #3

Updated by Anonymous over 10 years ago

  • Target version changed from 1.10.0 to 1.9.3
Actions #4

Updated by Hannes Schaller over 10 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
Actions #5

Updated by Tomáš Strachota over 10 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.

Actions #6

Updated by Dominic Cleal over 10 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...

Actions #7

Updated by Martin Bacovsky over 10 years ago

  • Status changed from New to Assigned
  • Assignee set to Martin Bacovsky
Actions #8

Updated by Martin Bacovsky over 10 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.

Actions #9

Updated by Martin Bacovsky over 10 years ago

  • Status changed from Assigned to Ready For Testing
Actions #10

Updated by Martin Bacovsky over 10 years ago

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

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

Actions

Also available in: Atom PDF