Bug 2023281 - search filter "host_collection != " for a content host does not work.
Summary: search filter "host_collection != " for a content host does not work.
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Host Collections
Version: 6.9.0
Hardware: Unspecified
OS: Unspecified
low
medium
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: Satellite QE Team
URL:
Whiteboard:
: 2158849 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-11-15 11:32 UTC by Vedashree Deshpande
Modified: 2023-06-29 16:17 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-06-29 16:17:13 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker SAT-18288 0 None None None 2023-06-12 15:56:10 UTC
Red Hat Knowledge Base (Solution) 7003642 0 None None None 2023-04-25 22:39:47 UTC

Description Vedashree Deshpande 2021-11-15 11:32:10 UTC
Description of problem:
We try to search hosts not in specified host collection using !=, example:
host_collection != AnsibleTower-PR 
this does not work.


Version-Release number of selected component (if applicable):
Satellite 6.x

Actual results:
When we search for any host which does not belong to any host_collection using the filter host_collection != it does not give any answer. 

Expected results:
It should give the right answer. 

Additional info / workaround:
"not host_collection = Test" instead of "host_collection != Test" to make it work

Comment 2 Lucy Fu 2023-04-25 22:39:48 UTC
*** Bug 2158849 has been marked as a duplicate of this bug. ***

Comment 3 Lucy Fu 2023-06-26 18:55:05 UTC
If you search with the != expression, every event that has a value in the field, where that value does not match the value you specify, is returned. Events that do not have a value in the field are not included in the results.

If you search with the NOT operator, every event is returned except the events that contain the value you specify. This includes events that do not have a value in the field.

For more information, please check: https://docs.splunk.com/Documentation/SplunkCloud/latest/Search/NOTexpressions.

So the search filter is working as designed.

Comment 4 Paul Dudley 2023-06-26 19:18:17 UTC
Hi Lucy,

I previously opened bz 2158849 which was closed in favor of this one. In https://bugzilla.redhat.com/show_bug.cgi?id=2158849#c1 you can see that when using != in the search the query is built in such a way as to fail. To highlight the line;
~~~
WHERE "katello_host_collections"."name" <> 'test3' )))) ORDER BY "hosts".""name ASC LIMIT $2 OFFSET $3
~~~

You can see there Satellite builds the query with this "hosts".""name bit, where name is not closed by a ". These queries can be ambiguous in nature when trying to know what to expect for a return, but surely we should expect the query to be built correctly before trusting what was returned?

Comment 5 Paul Dudley 2023-06-29 15:08:54 UTC
*** Bug 2158849 has been marked as a duplicate of this bug. ***


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