Project

General

Profile

Bug #22556

Host search with parent_hostgroup returns all hosts when there are no matches

Added by J. A. about 5 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
Difficulty:
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:
Red Hat JIRA:

Description

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.

Associated revisions

Revision 6beb3d8b (diff)
Added by Tomer Brisker about 5 years ago

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.
(see
https://github.com/wvanbergen/scoped_search/blob/v4.1.2/lib/scoped_search/query_builder.rb#L405
for the scoped_search part)

History

#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

Also available in: Atom PDF