Refactor #12747
closedProvide some kind of central store or consistent way to manage dynamically registered objects from plugins
Description
Currently, there are number of things you can register for plugins - compute resources, dashboard widgets, etc.
Dashboard widgets stores plugin registered widgets like this: https://github.com/theforeman/foreman/blob/develop/app/services/dashboard/manager.rb#L3
Compute resource store plugin registered resources like this: https://github.com/theforeman/foreman/blob/develop/app/models/compute_resource.rb#L13
It's all very inconsistent. We should standardize on a single way, perhaps even having some kind of central store to put this kind of data.
The problem when we re-invent this for every new dynamically registered thing, we introduce potential problems, like #12746.
Updated by Stephen Benjamin about 9 years ago
- Related to Bug #12746: Compute resources can disappear in a development instance added
Updated by Dominic Cleal about 9 years ago
The plugin classes should be stable in the development environment, so using an approach like we just did in #12624 (merging them on use) may be best: https://github.com/theforeman/foreman/commit/51685ba80898aa6835a2396c14c02d8af52aec13#diff-2d53894341fd1cf84a823e3bd0855495R552
Updated by Dominic Cleal almost 9 years ago
- Related to Bug #14300: after removing dashboard widgets none are listed to add back added
Updated by Dominic Cleal over 8 years ago
- Related to Bug #14742: Template kind friendly names from plugins can be reloaded and lost in development added
Updated by Dominic Cleal over 8 years ago
- Related to Bug #14969: Custom status is not reloaded correctly added
Updated by Dominic Cleal over 7 years ago
- Status changed from New to Resolved
Tentatively setting as resolved, as the app/registries/ directory added in #19317 should provide a standard location which is immune to autoloading in the development environment. It also provides a small amount of documentation about how best to implement registry-type objects.
However, per comment 2, the plugin classes are in stable in a development environment (they use this directory) and so new registries/stores/dynamically registered objects should not be added to app/registries/ unless absolutely necessary. They should return a built in list of entries, then append the list from plugins at runtime.