Project

General

Profile

Actions

Bug #12198

open

Adding template helpers from plugin not always working

Added by Stephen Benjamin over 8 years ago. Updated over 8 years ago.

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

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.

Actions #1

Updated by Dominic Cleal over 8 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.

Actions

Also available in: Atom PDF