Host search with parent_hostgroup returns all hosts when there are no matches
When searching for parent_hostgroup = "blablabla" where there is no hostgroup named "blablabla", the result includes all hosts. Performing the same search with other criteria like "name" or "comment" instead, the results includes no hosts when there are no matches. This is not necessarily a big deal for GUI searches, but for me it's problematic for API searches.
#1 Updated by The Foreman Bot about 5 years ago
- Assignee set to Tomer Brisker
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/5249 added
#2 Updated by Lukas Zapletal about 5 years ago
- Legacy Backlogs Release (now unused) set to 330
#3 Updated by Anonymous about 5 years ago
- % Done changed from 0 to 100
- Status changed from Ready For Testing to Closed
Applied in changeset 6beb3d8b15652e5a8dae3640806a1dbfbca8b046.
Fixes #22556 - Correct host search for parent hostgroup
Currently, searching on a non-existant parent fails due to
`hostgroup.subtree_ids` throwing a NoMethodError when no matching
hostgroup is found. This is rescued by scoped search, causing the
search to run with no conditions instead.
for the scoped_search part)