Bug #4563
closedruby193-rubygem-scoped_search-2.6.3-1.el6.noarch breaks searching via the api with foreman-1.4.1
Description
I upgraded to foreman-1.4.1 via yum update, and in the process it installed ruby193-rubygem-scoped_search-2.6.3-1.el6.noarch from the foreman yum repo. In the process my api calls to search broke.
I think it is doing something like transposing column names. It does fact_values.id = hosts.host_id, and I think it should be something like fact_values.host_id = hosts.id.
I worked around the issue with "yum downgrade ruby193-rubygem-scoped_search".
mmoll told me this relates to issue 4293
Curl call for testing:
curl -k -u 'user:pass' 'https://foreman.domain.com/api/fact_values?search=fact=ipaddress%20and%20host.hostgroup=lb.stage'
Curl error: {"error":{"message":"PGError: ERROR: column hosts.host_id does not exist\nLINE 3: ON fact_values.id = hosts.host_id \n ^\n: SELECT DISTINCT \"fact_values\".id, \"fact_values\".\"value\" AS alias_0 FROM \"fact_values\" LEFT OUTER JOIN \"fact_names\" ON \"fact_names\".\"id\" = \"fact_values\".\"fact_name_id\" LEFT OUTER JOIN \"hosts\" ON \"hosts\".\"id\" = \"fact_values\".\"host_id\" AND \"hosts\".\"type\" IN ('Host::Managed') LEFT OUTER JOIN \"hostgroups\" ON \"hostgroups\".\"id\" = \"hosts\".\"hostgroup_id\" LEFT OUTER JOIN \"hosts\" \"hosts_fact_values\" ON \"hosts_fact_values\".\"id\" = \"fact_values\".\"host_id\" AND \"hosts_fact_values\".\"type\" IN ('Host::Managed') WHERE (fact_names.name <> '_timestamp') AND (((\"fact_names\".\"name\" = 'internal_ipaddress') AND (fact_values.id IN (SELECT host_id FROM fact_values\n INNER JOIN hosts\n ON fact_values.id = hosts.host_id \n INNER JOIN hostgroups\n ON hosts.hostgroup_id = hostgroups.id \n WHERE \"hostgroups\".\"name\" = 'lb.stage' )))) ORDER BY \"fact_values\".\"value\" ASC NULLS FIRST LIMIT 20 OFFSET 0"}}
Curl good output with older scoped_search: {"lb02.stage.pop.i.domain.com":{"ipaddress":"10.196.114.133"},"lb03.stage.pop.i.domain.com":{"ipaddress":"10.196.154.101"},"lb04.stage.pop.i.domain.com":{"ipaddress":"10.196.20.194"},"lb01.stage.pop.i.domain.com":{"ipaddress":"10.196.2.120"}}
Updated by Anonymous over 10 years ago
- Related to Bug #4293: Scoped search breaks on some relations added
Updated by Dominic Cleal over 10 years ago
- Project changed from Packaging to Foreman
- Category set to Search
- Assignee set to Amos Benari
Updated by Amos Benari over 10 years ago
- Status changed from New to Ready For Testing
a new version of scoped search (2.6.5) that fixes the issue is available.
Updated by Dominic Cleal over 10 years ago
- Status changed from Ready For Testing to Closed
- Target version set to 1.9.0
- % Done changed from 0 to 100
- Translation missing: en.field_release set to 7
Built 2.6.5 into RPM nightly, will push with 1.4.2 if all is good there.
http://koji.katello.org/packages/ruby193-rubygem-scoped_search/2.6.5/1.el6/noarch/ruby193-rubygem-scoped_search-2.6.5-1.el6.noarch.rpm if you want to test it.