Project

General

Profile

Actions

Refactor #13039

closed

Remove DB queries from class of UnattendedController

Added by Dominic Cleal over 8 years ago. Updated almost 6 years ago.

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

Description

UnattendedController makes DB queries for TemplateKinds in the class scope to define methods and set up action filters. This bad style causes a problem in foreman_bootdisk which adds a method chain to the provision method in the class. When running tests under Rails 4, if the controller's instantiated too early, the right methods aren't defined.

  4) Error:
UnattendedControllerTest#test_0002_should get a kickstart even if not using the first NIC:
AbstractController::ActionNotFound: The action 'provision' could not be found for UnattendedController
    test/functional/unattended_controller_test.rb:43:in `block in <class:UnattendedControllerTest>'

Changing this to make queries when it's called would create more testable code both in core and the plugin.


Related issues 3 (0 open3 closed)

Related to Foreman - Refactor #13409: Remove maintain_test_schema! Rails initializerClosedDominic Cleal01/27/2016Actions
Related to Foreman - Bug #15490: CVE-2016-4995 - view_hosts permissions/filters not checked for provisioning template previewsClosedLukas Zapletal06/22/2016Actions
Related to Foreman - Bug #10689: Unattended controller permission check does not workDuplicateLukas Zapletal06/03/2015Actions
Actions

Also available in: Atom PDF