Project

General

Profile

Actions

Bug #29070

closed

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

Added by Ian Ballou about 4 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Organizations and Locations
Target version:
-
Difficulty:
Triaged:
No
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 1 (0 open1 closed)

Blocked by Katello - Bug #29142: Delete all http proxies in test setupClosedIan BallouActions
Actions #1

Updated by Ian Ballou about 4 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.

Actions #2

Updated by Ian Ballou about 4 years ago

  • Project changed from Katello to Foreman
Actions #3

Updated by Ian Ballou about 4 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.

Actions #4

Updated by Ian Ballou about 4 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.

Actions #5

Updated by The Foreman Bot about 4 years ago

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

Updated by Ian Ballou about 4 years ago

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

Updated by The Foreman Bot about 4 years ago

  • Fixed in Releases 2.1.0 added
Actions #8

Updated by Anonymous about 4 years ago

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

Updated by Amit Upadhye almost 4 years ago

  • Category set to Organizations and Locations
Actions

Also available in: Atom PDF