Project

General

Profile

Bug #20580

"hammer host-collection list --host" produce error 500 - undefined method `order'

Added by Brad Buckingham almost 5 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Normal
Category:
Host Collections
Target version:
Difficulty:
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:
Red Hat JIRA:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1479284

Description of problem:

When filtering `hammer host-collection list` by host (both --host-id and --host), it fails with 500 error and message 'undefined method `order' for #<Array:0x00000014c20740>'

  1. hammer -d -v -u admin -p changeme host-collection list --host-id="2"

[ INFO 2017-08-08 04:45:09 HammerCLI::MainCommand] Called with options: {"option_verbose"=>true, "option_debug"=>true, "option_username"=>"admin", "option_password"=>"***"}
[ INFO 2017-08-08 04:45:09 HammerCLIKatello::HostCollection] Called with options: {}
[ INFO 2017-08-08 04:45:09 HammerCLIKatello::HostCollection::ListCommand] Called with options: {"option_host_id"=>2}
[ INFO 2017-08-08 04:45:09 API] Server: https://intel-wildcatpass-05.khw.lab.eng.bos.redhat.com
[ INFO 2017-08-08 04:45:09 API] GET /katello/api/host_collections
[DEBUG 2017-08-08 04:45:09 API] Params: {
"page" => 1,
"per_page" => 1000,
"sort" => {},
"host_id" => 2
}
[DEBUG 2017-08-08 04:45:09 API] Headers: {
:params => {
"page" => 1,
"per_page" => 1000,
"sort" => {},
"host_id" => 2
}
}
[DEBUG 2017-08-08 04:45:09 API] Using authenticator: HammerCLIForeman::Api::InteractiveBasicAuth
[ERROR 2017-08-08 04:45:09 API] 500 Internal Server Error
[DEBUG 2017-08-08 04:45:09 API] {
"displayMessage" => "undefined method `order' for #<Array:0x007f10606de008>",
"errors" => [
[0] "undefined method `order' for #<Array:0x007f10606de008>"
]
}

Version-Release number of selected component (if applicable):
Satellite 6.3 Snap 10:
  • satellite-6.3.0-16.0.beta.el7sat.noarch
  • foreman-1.15.2-1.el7sat.noarch
  • katello-3.4.4-2.el7sat.noarch
  • tfm-rubygem-hammer_cli_foreman-0.10.2-1.el7sat.noarch
  • tfm-rubygem-hammer_cli_katello-0.10.0-1.el7sat.noarch

How reproducible:
Always

Steps to Reproduce:
1. Create host
2. Create host collection
3. Add host to that host collection
4. List host collections and filter by that host, like:
hammer -d -v host-collection list --host-id="2"

Actual results:
500 error

Expected results:
Host collections should be listed


Related issues

Has duplicate Katello - Bug #20586: Internal server error when viewing the activation-key host collectionsDuplicate2017-08-14

Associated revisions

Revision 016c499f (diff)
Added by Brad Buckingham almost 5 years ago

fixes #20580 - error listing host collections on a host

Without this change, the user will observe an error when listing
the host collections associated with a content host:

2017-08-14T16:45:00 922f5a3b [app] [E] NoMethodError:
undefined method `order' for #<Array:0x007f494d5162b8> | katello/api/v2/api_controller.rb:74:in `scoped_search' | katello/api/v2/host_collections_controller.rb:37:in `index'

Similar should also occur for listing host collections associated
with an activation key.

Cause was that the object returned for those cases was
a 'CollectionProxy', which will be converted to an Array
when 'uniq' is invoked on it.

History

#1 Updated by Brad Buckingham almost 5 years ago

  • Subject changed from "hammer host-collection list --host" produce error 500 - undefined method `order' to "hammer host-collection list --host" produce error 500 - undefined method `order'
  • Target version set to 208

#2 Updated by The Foreman Bot almost 5 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/Katello/katello/pull/6909 added

#3 Updated by Brad Buckingham almost 5 years ago

  • Has duplicate Bug #20586: Internal server error when viewing the activation-key host collections added

#4 Updated by Eric Helms almost 5 years ago

  • Legacy Backlogs Release (now unused) set to 286

#5 Updated by Brad Buckingham almost 5 years ago

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

Also available in: Atom PDF