Project

General

Profile

Actions

Bug #23993

closed

Filtering of some entities does not work

Added by Ivan Necas almost 6 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Category:
Hammer
Target version:
Difficulty:
Triaged:
Yes
Fixed in Releases:
Found in Releases:

Description

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

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:
  1. 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:


Related issues 4 (2 open2 closed)

Related to Katello - Bug #15701: Allow Foreman objects to resolve using `create_search_options_creators_without_katello_api`ClosedAndrew Kofink07/15/2016Actions
Related to Katello - Bug #24063: Investigate running hammer-cli-foreman tests with hammer-cli-katello loadedNewAndrew Kofink06/25/2018Actions
Related to Katello - Refactor #26027: hammer_cli_katello resolvers interfere with foreman onces on katello-extended resourcesNewChristine FouantActions
Copied to Katello - Bug #25027: Filtering of some entities does not workClosedChristine FouantActions
Actions #1

Updated by Tomáš Strachota almost 6 years ago

  • Subject changed from Filtering of some entities does not work to Filtering of some entities does not work
  • Status changed from New to Need more information

The issue description doesn't mention what commands are actually broken. Waiting for more information form the original BZ.

Actions #2

Updated by Ivan Necas almost 6 years ago

  • Project changed from Hammer CLI to Katello
  • Category changed from Other commands to Hammer
  • Status changed from Need more information to New

One such an example is:

hammer -d host create --compute-resource 'blacr' --name 'bla' --environment="test" --architecture='x86_64' --domain local.test --operatingsystem 'RedHat 7.5' --partition-table='Kickstart default' --location='Default Location' --organization='Default Organization'

The issue only reproduces when katello plugin is enabled, therefore changing the component to Katello.

Actions #3

Updated by Ivan Necas almost 6 years ago

  • Related to Bug #15701: Allow Foreman objects to resolve using `create_search_options_creators_without_katello_api` added
Actions #4

Updated by Ivan Necas almost 6 years ago

I've tracked the issue down to https://projects.theforeman.org/issues/15701, where we started going down the road to override the foreman-related resources in Katello.

Something else had to change as well, as compute resources were not causing issues before. Anyway, this approach proved itself to be quite risky and I believe it should be reconsidered in hammer-cli-katello, as every searchable added to Foreman (and perhaps even to other plugins) will be broken once Katello plugin is enabled.

Actions #5

Updated by Ivan Necas almost 6 years ago

  • Related to Bug #24063: Investigate running hammer-cli-foreman tests with hammer-cli-katello loaded added
Actions #6

Updated by Andrew Kofink almost 6 years ago

  • translation missing: en.field_release set to 338
Actions #7

Updated by Andrew Kofink almost 6 years ago

  • translation missing: en.field_release changed from 338 to 349
Actions #8

Updated by Andrew Kofink almost 6 years ago

  • translation missing: en.field_release changed from 349 to 369
Actions #9

Updated by The Foreman Bot over 5 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Christine Fouant
  • Pull request https://github.com/Katello/hammer-cli-katello/pull/574 added
Actions #10

Updated by Christine Fouant over 5 years ago

  • Status changed from Ready For Testing to Closed
Actions #11

Updated by Christine Fouant over 5 years ago

  • Copied to Bug #25027: Filtering of some entities does not work added
Actions #12

Updated by Ivan Necas about 5 years ago

  • Related to Refactor #26027: hammer_cli_katello resolvers interfere with foreman onces on katello-extended resources added
Actions

Also available in: Atom PDF