Project

General

Profile

Actions

Bug #4314

closed

unable to filter on classes

Added by Adam Winberg almost 11 years ago. Updated over 6 years ago.

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

Description

After update to 1.4.0 I can no longer filter host lists based on classes. Regardless of which class i try to filter with, theforeman returns all hosts as a result.

Example of query:
/hosts?search=class=cacti

should return one host but returns all hosts.

Actions #1

Updated by Dominic Cleal almost 11 years ago

  • Project changed from Hammer CLI to Foreman
  • Category changed from Foreman commands (obsolete) to Search
Actions #2

Updated by Adam Winberg almost 11 years ago

Got this from production.log in debug mode:

Hostgroup Load (0.6ms)  SELECT DISTINCT hostgroups.id FROM "hostgroups" INNER JOIN "hostgroup_classes" ON "hostgroup_classes"."hostgroup_id" = "hostgroups"."id" INNER JOIN "puppetclasses" ON "puppetclasses"."id" = "hostgroup_classes"."puppetclass_id" WHERE (puppetclasses.name = 'foreman') ORDER BY hostgroups.label
PGError: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list
LINE 1: ..." WHERE (puppetclasses.name = 'foreman') ORDER BY hostgroups...

The PGError indicates there is something wrong with the query. Adjusting the query to include 'hostgroups.label' in the SELECT gets rid of this error, dont know where in the source this is set though.

Actions #3

Updated by Adam Winberg over 10 years ago

changing row 34 in app/models/hostgroup.rb from

order("hostgroups.label")

to

order("hostgroups.id")

fixes the problem. But does it introduce other problems?

Actions #4

Updated by Dominic Cleal over 10 years ago

It'd mean the sorting of the host groups in the main list is by their numerical IDs rather than their names. We changed to this a while ago in #3107 for improved usability.

Actions #5

Updated by Dominic Cleal over 10 years ago

  • Status changed from New to Assigned
  • Assignee set to Dominic Cleal
  • Target version set to 1.9.0
  • Translation missing: en.field_release set to 7
Actions #6

Updated by Dominic Cleal over 10 years ago

  • Status changed from Assigned to Ready For Testing
Actions #7

Updated by Dominic Cleal over 10 years ago

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

Also available in: Atom PDF