Bug #19317

Plugin and dashboard widget registry auto-reloaded

Added by Dominic Cleal 9 months ago. Updated 7 months ago.

Status:Closed
Priority:Normal
Assigned To:Dominic Cleal
Category:Rails
Target version:-
Difficulty: Bugzilla link:
Found in release: Pull request:https://github.com/theforeman/foreman/pull/4472, https://github.com/theforeman/foreman/pull/4507
Story points-
Velocity based estimate-
Release1.16.0Release relationshipAuto

Description

Since #18445, the plugin and related classes may be reloaded, losing registrations - probably for plugin registrations, default dashboard widgets, modified menu items, and permissions.

The change to use require_dependency will allow Rails to track the constants and reload them when the source files are modified, discarding the class variable. The use of require_dependency is however required to ensure eager loading doesn't load the file twice (#18445).

The source files may need to be moved to prevent double-loading and to be excluded from autoloading.


Related issues

Related to Foreman - Bug #18445: "Cannot define multiple 'included' blocks" for audit_exte... Closed 02/09/2017
Related to Foreman - Bug #10927: Resetting dashboard to default widgets adds no widgets Closed 06/25/2015
Related to Katello - Bug #19351: transient test failure Closed 04/21/2017
Duplicated by Foreman - Bug #19318: Plugins infrastructure don't work reliably in development Duplicate 04/19/2017
Duplicated by Katello - Bug #19290: Unable to retrieve API bindings via hammer Duplicate 04/17/2017

Associated revisions

Revision 40fffe69
Added by Dominic Cleal 9 months ago

fixes #19317, #10927 - move registries to autoload_once path

Partially reverts 70ce8fe to reinstate autoload_once_paths as the
preferred way to load registry-type objects with class variables
containing data set up during app initialisation (e.g. plugin
registrations, menu items.)

autoload_once is compatible with using require_dependency, which is
preferred to allow Rails to track which constants are loaded, so eager
loading doesn't ever try to load the same file twice (7923c95.)

This moves all registry-type objects to app/registries/ and marks this
path as being autoload_once. The contents of this directory should be
kept at an absolute minimum to ease development.

Revision e74bf5ab
Added by Dominic Cleal 9 months ago

refs #19317 - move FiltersHelperOverrides to app/registries/

Uses class to hold state, should be kept in the autoload_once registry
directory.

History

#1 Updated by Dominic Cleal 9 months ago

  • Related to Bug #18445: "Cannot define multiple 'included' blocks" for audit_extensions with eager_load enabled added

#2 Updated by Tomer Brisker 9 months ago

  • Related to Bug #10927: Resetting dashboard to default widgets adds no widgets added

#3 Updated by Dominic Cleal 9 months ago

  • Duplicated by Bug #19318: Plugins infrastructure don't work reliably in development added

#4 Updated by John Mitsch 9 months ago

  • Duplicated by Bug #19290: Unable to retrieve API bindings via hammer added

#5 Updated by The Foreman Bot 9 months ago

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

#6 Updated by Justin Sherrill 9 months ago

  • Related to Bug #19351: transient test failure added

#7 Updated by Dominic Cleal 9 months ago

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

#8 Updated by The Foreman Bot 9 months ago

  • Pull request https://github.com/theforeman/foreman/pull/4507 added

#9 Updated by Marek Hulán 7 months ago

  • Release set to 1.16.0

Also available in: Atom PDF