Project

General

Profile

Bug #13937

Can't search host by domain parameters

Added by Ori Rabin about 4 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Search
Target version:
Difficulty:
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

Searching a host by a parameter that is connected to it's domain results in the following error:

PG::Error: ERROR: column hosts.domain_id does not exist LINE 1: ...WHERE "hosts"."type" IN ('Host::Managed') AND ((( hosts.doma... ^ : SELECT "hosts".* FROM "hosts" WHERE "hosts"."type" IN ('Host::Managed') AND ((( hosts.domain_id = 1 ))) ORDER BY "hosts"."name" ASC LIMIT 20 OFFSET 0

This is a result of trying to add a condition on hosts.domain_id: https://github.com/theforeman/foreman/blob/develop/app/models/concerns/hostext/search.rb#L212

domain_id is delegated to primary_interface but since search_by_params constructs a sql condition directly that doesn't help.
The condition in search_by_params needs to add the join to get the domain_id.

Associated revisions

Revision f2506d34 (diff)
Added by Ori Rabin about 4 years ago

Fixes #13937 - search by domain parameters searches on primary_interface

Revision 6b9b746e (diff)
Added by Ori Rabin almost 4 years ago

Fixes #13937 - search by domain parameters searches on primary_interface

(cherry picked from commit f2506d3482098dcd4faffe64c036f139d77034d7)

History

#1 Updated by Ori Rabin about 4 years ago

  • Category set to Search

#2 Updated by The Foreman Bot about 4 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Ori Rabin
  • Pull request https://github.com/theforeman/foreman/pull/3268 added

#3 Updated by Ori Rabin about 4 years ago

  • Bugzilla link set to 1313878

#4 Updated by Ori Rabin about 4 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#5 Updated by Dominic Cleal about 4 years ago

  • Legacy Backlogs Release (now unused) set to 141

Also available in: Atom PDF