Project

General

Profile

Bug #12644

Ordering smart variables list by Puppet class throws "no such column: puppetclasses.name" error

Added by Dominic Cleal over 3 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Smart Variables
Target version:
Difficulty:
Triaged:
Bugzilla link:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

When on the smart variables or smart class parameters index pages, clicking on the Puppet class column heading to sort the variables by class throws the following error:

SQLite3::SQLException: no such column: puppetclasses.name: SELECT  "lookup_keys"."puppetclass_id" FROM "lookup_keys"  WHERE "lookup_keys"."type" IN ('VariableLookupKey') ORDER BY "puppetclasses"."name" ASC LIMIT 40 OFFSET 0

Associated revisions

Revision 0e9b35eb (diff)
Added by Tomer Brisker over 3 years ago

Fixes #12644, #12643 - Correctly authorize in lookup key index

There was a problem with the authorizer for lookup key indices that led
to problems with sorting and searching.
Because `#includes` lazy loads the included relation, and the authorizer
didn't need the relation, it didn't load the puppetclass or the
lookup_value table. However, the search_for scope added an order_by or a
where condition to @lookup_keys, which caused the authorizer collection
to create an invalid query.

Revision 5e77d766 (diff)
Added by Tomer Brisker over 3 years ago

Fixes #12644, #12643 - Correctly authorize in lookup key index

There was a problem with the authorizer for lookup key indices that led
to problems with sorting and searching.
Because `#includes` lazy loads the included relation, and the authorizer
didn't need the relation, it didn't load the puppetclass or the
lookup_value table. However, the search_for scope added an order_by or a
where condition to @lookup_keys, which caused the authorizer collection
to create an invalid query.

(cherry picked from commit 0e9b35eb264ebfd7630aca7eba72213c6d5a9fa1)

History

#1 Updated by Tomer Brisker over 3 years ago

  • Status changed from New to Assigned
  • Assignee set to Tomer Brisker

#2 Updated by The Foreman Bot over 3 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/2958 added

#3 Updated by Anonymous over 3 years ago

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

#4 Updated by Dominic Cleal over 3 years ago

  • Legacy Backlogs Release (now unused) set to 104

Also available in: Atom PDF