Bug #12198
openAdding template helpers from plugin not always working
Description
Katello uses this to add the "subscription_manager_configuration_url" helper: https://github.com/theforeman/foreman/blob/develop/app/services/foreman/plugin.rb#L227
For some reason, we get an error when using the host group templates:
There was an error rendering the Unnamed template: The snippet 'subscription_manager_registration' threw an error: Safemode doesn't allow to access 'subscription_manager_configuration_url' on #<Safemode::ScopeObject>
It doesn't appear to be deterministic, is there something odd with how the constant is redefined?
Adding the helper to the Hostgroup::Jail works consistently.
Updated by Dominic Cleal about 9 years ago
In a development or production environment? If development only, then it may point to a reloading issue.
The renderer, and therefore the constant (the er, mutable constant) shouldn't get reloaded as it's required from config/initializers/foreman.rb during startup. My only thought is that a plugin is requiring UnattendedController, so it gets loaded before that initialiser runs - this could perhaps cause the renderer to get auto reloaded when we don't intend it to be.