Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1596157 - Searching host in satellite with specific organization and location is not working as expected
Summary: Searching host in satellite with specific organization and location is not wo...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Hosts
Version: 6.3.0
Hardware: x86_64
OS: All
unspecified
low
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: tstrych
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-06-28 10:40 UTC by Ranjan Kumar
Modified: 2021-09-09 14:47 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-02-03 16:29:49 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Steps (673.21 KB, image/gif)
2018-06-28 10:40 UTC, Ranjan Kumar
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 24594 0 None None None 2018-08-13 12:49:23 UTC

Description Ranjan Kumar 2018-06-28 10:40:44 UTC
Created attachment 1455237 [details]
Steps

Description of problem: Search a host in a satellite with specific organization and location is not working as expected


Version-Release number of selected component (if applicable):6.3.0


How reproducible: Always


Steps to Reproduce:
1. Create organization org1 and location loc1
1. Create a host "host1" on satellite and assign org1 and loc1
3. Switch to any Context
4. Go to All hosts 
5. Try to locate host with a filter "organization=org1 and location=loc1"

Actual results: List 0 result


Expected results: It should list "host1"


Additional info: Workaround
Use filter "organization=org1 and location_id=<location-id>"

Comment 2 Adam Ruzicka 2018-08-13 12:48:17 UTC
This probably boils down to how scoped_search constructs the query. 

When I run the following in the rails console

Host.search_for('location = Somewhere and organization = Something').count

the SQL which gets executed is

SELECT COUNT(DISTINCT "hosts"."id") FROM "hosts"
       LEFT OUTER JOIN "taxonomies" ON "taxonomies"."id" = "hosts"."location_id" AND "taxonomies"."type" IN ('Location')
       LEFT OUTER JOIN "taxonomies" "organizations_hosts" ON "organizations_hosts"."id" = "hosts"."organization_id" AND "organizations_hosts"."type" IN ('Organization')
       WHERE "hosts"."type" IN ('Host::Managed') AND
             ((("taxonomies"."title" = 'Somewhere') AND ("taxonomies"."title" = 'Something')))

The part with taxonomies.title ensures this never matches any host, almost as if scoped search forgot that it renamed the second joined table as "organizations_hosts".

Opened an issue[1] at the scoped_search upstream repository.

[1] - https://github.com/wvanbergen/scoped_search/issues/180

Comment 3 Adam Ruzicka 2018-08-13 12:49:21 UTC
Created redmine issue http://projects.theforeman.org/issues/24594 from this bug

Comment 4 Bryan Kearney 2020-01-15 21:00:47 UTC
The Satellite Team is attempting to provide an accurate backlog of bugzilla requests which we feel will be resolved in the next few releases. We do not believe this bugzilla will meet that criteria, and have plans to close it out in 1 month. This is not a reflection on the validity of the request, but a reflection of the many priorities for the product. If you have any concerns about this, feel free to contact Red Hat Technical Support or your account team. If we do not hear from you, we will close this bug out. Thank you.

Comment 5 Bryan Kearney 2020-02-03 16:29:49 UTC
Thank you for your interest in Satellite 6. We have evaluated this request, and while we recognize that it is a valid request, we do not expect this to be implemented in the product in the foreseeable future. This is due to other priorities for the product, and not a reflection on the request itself. We are therefore closing this out as WONTFIX. If you have any concerns about this, please do not reopen. Instead, feel free to contact Red Hat Technical Support. Thank you.


Note You need to log in before you can comment on or make changes to this bug.