Project

General

Profile

Bug #29070

Searching for HTTP Proxy by Organization/Location is wrong in certain cases with Any Organization and Any Location

Added by Ian Ballou 6 months ago. Updated 3 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Organizations and Locations
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Fixed in Releases:
Found in Releases:

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"


Related issues

Blocked by Katello - Bug #29142: Delete all http proxies in test setupClosed

Associated revisions

Revision a0bbfb28 (diff)
Added by Ian Ballou 5 months ago

Fixes #29070 - HTTP Proxy taxonomy searching incorrect

History

#1 Updated by Ian Ballou 6 months 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.

#2 Updated by Ian Ballou 6 months ago

  • Project changed from Katello to Foreman

#3 Updated by Ian Ballou 6 months 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.

#4 Updated by Ian Ballou 6 months 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.

#5 Updated by The Foreman Bot 5 months ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/7458 added

#6 Updated by Ian Ballou 5 months ago

  • Blocked by Bug #29142: Delete all http proxies in test setup added

#7 Updated by The Foreman Bot 5 months ago

  • Fixed in Releases 2.1.0 added

#8 Updated by Anonymous 5 months ago

  • Status changed from Ready For Testing to Closed

#9 Updated by Amit Upadhye 3 months ago

  • Category set to Organizations and Locations

Also available in: Atom PDF