Bug #29070
closedSearching for HTTP Proxy by Organization/Location is wrong in certain cases with Any Organization and Any Location
Description
All errors appear with Any Organization and Any Location are selected on top.
The following searches erroneously lists all proxies:
1) location= "Default Location"
2) organization= "Default Organization"
3) location= "Default Organization"
4) organization= "Default Location"
Note that these errors occur only for Default Organization/Location.
Numbers 3) and 4) are interesting because they are in the suggested filter drop down but do not make sense.
There seems to be some kind of mixing of organization and location since the following search works if "My Custom Organization" is attached to some HTTP Proxy:
location= "My Custom Organization" -> Lists only the HTTP Proxy that belongs to "My Custom Organization"
Updated by Ian Ballou almost 5 years ago
It appears that the mixing of Organizations and Locations in the filter suggestion drop down occurs regardless of the global organization and location. This issue also occurs outside of HTTP Proxies (like with Domains), so it seems to be a separate problem with Foreman.
Updated by Ian Ballou almost 5 years ago
- Project changed from Katello to Foreman
Updated by Ian Ballou almost 5 years ago
The results are the same if searching with the v2 API as well. Querying https://admin:changeme@centos7-katello-devel-stable.example.com/api/http_proxies?search=location%3D+%22Default+Location%22 returns all HTTP Proxies, even the ones that don't belong to the Default Location.
Updated by Ian Ballou almost 5 years ago
It appears that the SQL query for the HTTP Proxies is missing a
AND taxable_type = 'HttpProxy'on the line
ON "http_proxies"."id" = "taxable_taxonomies"."taxable_id"
Here is the SQL:
SELECT "http_proxies"."id" AS t0_r0, "http_proxies"."name" AS t0_r1, "http_proxies"."url" AS t0_r2, "http_proxies"."username" AS t0_r3, "http_proxies"."password" AS t0_r4, "taxonomies"."id" AS t1_r0, "taxonomies"."name" AS t1_r1, "taxonomies"."type" AS t1_r2, "taxonomies"."created_at" AS t1_r3, "taxonomies"."updated_at" AS t1_r4, "taxonomies"."ignore_types" AS t1_r5, "taxonomies"."description" AS t1_r6, "taxonomies"."label" AS t1_r7, "taxonomies"."ancestry" AS t1_r8, "taxonomies"."title" AS t1_r9, "taxonomies"."manifest_refreshed_at" AS t1_r10 FROM "http_proxies" LEFT OUTER JOIN "taxable_taxonomies" ON "taxable_taxonomies"."taxable_id" = "http_proxies"."id" AND "taxable_taxonomies"."taxable_type" = 'HttpProxy' LEFT OUTER JOIN "taxonomies" ON "taxonomies"."id" = "taxable_taxonomies"."taxonomy_id" AND "taxonomies"."type" = 'Organization' WHERE (("http_proxies"."id" IN (SELECT "http_proxies"."id" FROM "http_proxies" INNER JOIN "taxable_taxonomies" ON "http_proxies"."id" = "taxable_taxonomies"."taxable_id" INNER JOIN "taxonomies" ON "taxable_taxonomies"."taxonomy_id" = "taxonomies"."id" WHERE "taxonomies"."name" = 'Default Organization' ))) ORDER BY http_proxies.name
Adding that SQL manually fixes the issue, but I'm not sure yet why it isn't being added. The SQL to search for Domain, for example, has that extra SQL in it.
Updated by The Foreman Bot almost 5 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/7458 added
Updated by Ian Ballou almost 5 years ago
- Blocked by Bug #29142: Delete all http proxies in test setup added
Updated by Anonymous almost 5 years ago
- Status changed from Ready For Testing to Closed
Applied in changeset a0bbfb283fee781ac3dba6f79703771a194af4ec.
Updated by Amit Upadhye over 4 years ago
- Category set to Organizations and Locations