Bug #4314
closedunable to filter on classes
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.
Updated by Dominic Cleal almost 11 years ago
- Project changed from Hammer CLI to Foreman
- Category changed from Foreman commands (obsolete) to Search
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.
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?
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.
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
Updated by Dominic Cleal over 10 years ago
- Status changed from Assigned to Ready For Testing
Updated by Dominic Cleal over 10 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset a44dd0943b5ccc2c2e9a0ce264e4b2f38b5edd4d.