Project

General

Profile

Bug #19735

Plugin API for extending template helpers does not work

Added by Lukas Zapletal over 2 years ago. Updated about 2 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Templates
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:

Description

We added extend_template_helpers API methods but it does not work, methods added via this extension are not available in Foreman::Renderer. Rendering is not possible:

Create a plugin, add new method, try to use it in a template in both safemode and non-safemode. Result:

There was an error rendering the Discovery Red Hat kexec template: undefined local variable or method `discovery_kexec_kernel' for #<#<Class:0x0055f4717ade40>:0x0055f471772c28>
Did you mean?  discovery_rule_url

Related issues

Related to Foreman - Feature #14588: Improve extending template helpers from plugin Closed2016-04-12
Related to Discovery - Refactor #19737: Kernel and initram not shown in preview modeClosed

History

#1 Updated by Lukas Zapletal over 2 years ago

  • Related to Feature #14588: Improve extending template helpers from plugin added

#2 Updated by Lukas Zapletal over 2 years ago

  • Related to Refactor #19737: Kernel and initram not shown in preview mode added

#3 Updated by Lukas Zapletal over 2 years ago

Side note: I observed that the extension mechanism is called every request, so every request we are iterating through plugins and re-including and re-extending all methods.

#4 Updated by Marek Hulán about 2 years ago

Lukas, could you please add a reproducer? It seems to work fine for foreman_chef and I don't see how it would be called multiple times if you put this into the plugin initializer.

Also available in: Atom PDF