UnattendedController does not render global methods defined in plugins
UnattendedController includes Foreman::Renderer while TemplatesController includes UnattendedHelper (which itself includes Foreman::Renderer).
This can cause issues because the plugin macro extend_template_helpers extends UnattendedHelper and the methods aren't available in UnattendedController.
#3 Updated by Timo Goebel over 1 year ago
- Subject changed from Foreman::Renderer vs UnattendedHelper to UnattendedController does not render global methods defined in plugins
The issue, I see is the following. I (properly) defined template macro from a plugin (transpile_container_linux_config) works fine in preview but not when a template is rendered via the unattended controller. Instead, it gives this error:
ActionView::Template::Error: undefined method `transpile_container_linux_config' for #<#<Class:0x00007f9ee7fa5b30>:0x00007f9ef0398028>
13:41:38 rails.1 | | Kickstart default clone:2:in `render_safe'
13:41:38 rails.1 | | /Users/f0218175/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/erb.rb:885:in `eval'
13:41:38 rails.1 | | /Users/f0218175/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/erb.rb:885:in `result'
13:41:38 rails.1 | | /Users/f0218175/foremandev/foreman/lib/foreman/renderer.rb:98:in `render_safe'
13:41:38 rails.1 | | /Users/f0218175/foremandev/foreman/lib/foreman/renderer.rb:205:in `unattended_render'
13:41:38 rails.1 | | inline template:1:in `_187d7febb380e19c2aad384a2281b7db'