Description of problem: Some entities can only be specified using --<entity>-id because when specified by name by --<entity>, search doesn't query for the name entered and returns multiple results. I discovered this for images and compute resources. By using 'hammer -d', I discovered the correct request and response (for the entity which works) are: [DEBUG 2018-05-31T12:08:08 API] Headers: { :params => { :search => "name = \"Kickstart default\"" } } [DEBUG 2018-05-31T12:08:08 API] Response: { "total" => 14, "subtotal" => 1, "page" => 1, "per_page" => 20, "search" => "name = \"Kickstart default\"", "sort" => { "by" => nil, "order" => nil }, ... Notice the request is in form ':search => "name = \"Kickstart default\""' and response shows non-nil 'search' param. And the incorrect ones are: [DEBUG 2018-05-31T12:08:08 API] Headers: { :params => { "compute_resource_id" => 1, "operatingsystem_id" => 1, "name" => "fish" } } [DEBUG 2018-05-31T12:08:09 API] Response: { "total" => 2, "subtotal" => 2, "page" => 1, "per_page" => 20, "search" => nil, "sort" => { "by" => nil, "order" => nil }, ... Notice the request is wrongly in form '"name" => "fish"' and 'search' in response is nil. Version-Release number of selected component (if applicable): Tested on Sat 6.4 snap 5 How reproducible: Deterministic Steps to Reproduce: # hammer host create --compute-resource-id 1 ... Actual results: Could not create the host: Error: Found more than one image. Expected results: Same as specifying the entity (compute resource in this case) by id Additional info:
Surprisingly, yes, this is a regression. On 6.3: # hammer -d host create --compute-resource-id 1 --architecture x86_64 --domain example.com --operatingsystem-id 1 --partition-table-id 1 --location-id 2 --organization-id 1 --name fish --root-password toortoor --image image1 Params: { "operatingsystem_id" => 1, :search => "name = \"image1\"" } [DEBUG 2018-06-14 09:37:14 API] Headers: { :params => { "operatingsystem_id" => 1, :search => "name = \"image1\"" } } Response: { "total" => 2, "subtotal" => 1, "page" => 1, "per_page" => 20, "search" => "name = \"image1\"", "sort" => { "by" => nil, "order" => nil }, "results" => [ [0] { "operatingsystem_id" => 1, "operatingsystem_name" => "RHEL Server 7.5", "compute_resource_id" => 1, "compute_resource_name" => "rhev3", "architecture_id" => 1, "architecture_name" => "x86_64", "uuid" => "7c5cc85e-a5be-4c7b-84a1-9dafbd556a14", "username" => "root", "created_at" => "2018-06-14 13:36:02 UTC", "updated_at" => "2018-06-14 13:36:02 UTC", "user_data" => false, "id" => 1, "name" => "image1" } ] }
Created redmine issue http://projects.theforeman.org/issues/23993 from this bug
Hi Lukas, it's not mentioned in the original bug description, but from your subsequent comment I guess it's the host create command that doesn't work. Have you observed the issue in some other commands too? If yes, could you name them please? It would be helpful if you could attach full -d log of the commands that are affected by this.
I was too harsh with devel triage, I was able to reproduced with foreman+katello, when I disabled the katello hammer plugin, it started working again, so it seems something from hammer-cli-katello is causing the troubles: The corresponding debug output is this: ``` ESC[32m INFOESC[0m ESC[34m2018-06-25T12:42:14ESC[0m ESC[36mAPIESC[0m] GET /api/compute_resources [DEBUG ESC[34m2018-06-25T12:42:14ESC[0m ESC[36mAPIESC[0m] Params: { "name" => "blacr" } [DEBUG ESC[34m2018-06-25T12:42:14ESC[0m ESC[36mAPIESC[0m] Headers: { :params => { "name" => "blacr" } } [DEBUG ESC[34m2018-06-25T12:42:14ESC[0m ESC[36mAPIESC[0m] Using authenticator: HammerCLIForeman::Api::InteractiveBasicAuth [DEBUG ESC[34m2018-06-25T12:42:14ESC[0m ESC[36mAPIESC[0m] Response: { "total" => 2, "subtotal" => 2, "page" => 1, "per_page" => 20, "search" => nil, "sort" => { "by" => nil, "order" => nil }, ```
I've tracked the issue down to this file https://github.com/katello/hammer-cli-katello/blob/5d263458e426b20b671ed6475d7379dd6174b941/lib/hammer_cli_katello/foreman_search_options_creators.rb - it seems that every searchable not explicitly mentioned there, will not get properly resolved, at least in the host commands. Easy fix would probably be adding the additional searchables there, but better approach would be to make the Katello's searchables opt-in, not opt-out, as they are right now.
*** Bug 1610695 has been marked as a duplicate of this bug. ***
*** Bug 1614360 has been marked as a duplicate of this bug. ***
In my duplicate there is some useful info: https://bugzilla.redhat.com/show_bug.cgi?id=1614360#c2
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/23993 has been resolved.
FailedQA with Sat 6.4 snap 21. Used reproducer from comment 2 on a Satellite with |images|>1, reproduced the bug.
Associating an upstream redmine (25027) that contains a fix for the failure. The change has been merged upstream; therefore, moving bug to POST.
This PR's unit tests failed. Brad, can someone take a look? satellite6/hammer_cli_katello/merge_requests/52
switching needinfo to Christine
This ended up being an issue with our tests pulling in the wrong version of a dependency. Cherrypick successfull
I tried the hammer host create command to create a host on RHEV and I specified every parameter by name rather than ID. I don't know of any other entity that can't be searched by name => verified with Sat 6.4 snap 24.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2018:2927