Bug #15050
closedISE on scoped search for Hosts
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1335044
Description of problem:
There is a nasty traceback while searching for an existing hostname in Content Hosts using scoped search.
search query: "my-host-1.domain.org"
production.log:
2016-05-11 04:30:59 [app] [I] Processing by Api::V2::HostsController#index as JSON
2016-05-11 04:30:59 [app] [I] Parameters: {"organization_id"=>"1", "page"=>"1", "search"=>"my-host-1.lab.eng.brq.redhat.com", "sort_by"=>"name", "sort_order"=>"ASC", "apiv"=>"v2"}
2016-05-11 04:30:59 [app] [W] Action failed
| PG::Error: ERROR: missing FROM-clause entry for table "organizations_hosts"
| LINE 1: ...14_r9, "taxonomies"."katello_default" AS t14_r10, "organizat...
searching for non-existing hostname works fine.
Version-Release number of selected component (if applicable):
6.2.0 Beta GA10.1
How reproducible:
always
Steps to Reproduce:
1. register a host to your satellite so it appears in Content Hosts
2. Try to put its hostname to the search field and hit search
3. check production.log
Actual results:
ISE
Expected results:
Search query is being validated performed on all applicable fields.
Additional info:
Workaround is to use the explicit-field search query:
name = my-host-1.domain.org or
name ~ my-host-1.domain.org
- I'm requesting a blocker flag for this BZ as this will be hit quite often by users (single word search queries are the most commonly used)
Updated by John Mitsch about 10 years ago
To reproduce in foreman use:
curl -X GET -u admin 'http://localhost:3000/api/v2/hosts?organization_id=2&search=<hostname>'
where <hostname> is an actual host's name.
This seems to be an error in scoped search. If you comment this line out
https://github.com/theforeman/foreman/blob/f4459c1/app/models/concerns/hostext/search.rb#L70
or add :only_explicit => true
that query works.
It seems to be a bug in scoped search that has already caused issues in foreman -
https://github.com/theforeman/foreman/commit/5185335248abd0104ec0b791df5e641eeae9da6b
Updated by Dominic Cleal about 10 years ago
- Category changed from Inventory to Search
I'm guessing you've a further search added by a plugin or Katello that adds in joins to taxonomies, and these are conflicting? This doesn't seem to happen on develop.
Updated by John Mitsch about 10 years ago
- Subject changed from ISE on scoped search for Content Hosts to ISE on scoped search for Hosts
I've tested and was able to recreate this on just a foreman (no katello or plugins) development environment.
Did you test that curl command using a host that had been already created? It only errors when you search for an actual host.
i.e. curl -X GET -u admin 'http://localhost:3000/api/v2/hosts?organization_id=2&search=myhost.example.com'
Updated by The Foreman Bot about 10 years ago
- Status changed from New to Ready For Testing
- Assignee set to John Mitsch
- Pull request https://github.com/theforeman/foreman/pull/3535 added
Updated by John Mitsch about 10 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset b9a3e39d0a62b1eda43b6ce8da54b636c1500e58.
Updated by Dominic Cleal about 10 years ago
- Translation missing: en.field_release set to 159