Project

General

Profile

Actions

Refactor #37920

open

Ensure reloading works with plugins

Added by Oleh Fedorenko about 1 month ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

After refactoring for Zeitwerk and Rails 7 upgrade, we lost the possibility to use code reloading in development environment.

Code reloading should still work for plain Foreman, doesn't work with at least one plugin enabled.

Known issues that need to be fixed:
- In Foreman settings are currently located in config/initializers, which we considered a safe option, but any plugin uses DSL to register their settings in their engine.rb within to_prepare block, which is called on every reloading. This leads to https://github.com/theforeman/foreman/blob/develop/app/registries/foreman/setting_manager.rb#L124.
I see at least two ways how to solve it:
1. Extract DSL uses for settings from to_prepare block. This will require revisiting all plugins, so I'd avoid that.
2. Ensure Foreman settings can be reloadable. The registries might be omitted from reloading, but the settings definitions could be emptied and repopulated on reloading.
- In REX, there is a compatibility constant assignment: https://github.com/theforeman/foreman_remote_execution/blob/master/app/models/ssh_execution_provider.rb#L80, which is "hated" by Zeitwerk. I'd suggest these solutions:
1. Remove that constant created for compatibility. If it was deprecated, I guess it's time to nuke that.
2. Find a better way to define the constant (this will probably make it unreloadable or will require more changes across the plugin)


Related issues 1 (1 open0 closed)

Related to Foreman - Tracker #34647: Rails 7.0 TrackerNewEwoud Kohl van Wijngaarden

Actions
Actions #1

Updated by Oleh Fedorenko about 1 month ago

Actions

Also available in: Atom PDF