Project

General

Profile

Bug #38129

Updated by Devyn Keeney 4 months ago

It appears that the Provisioning Template export functionality will only export a subset of the ERB template if the following is true: 
 * The template started with a ERB comment (i.e. <code><%# \n -%></code>) 
 * The template has a ERB output in it of <code>name</code> or any content with the content "name" in it <code>@host.hostname</code> 

 As a minimal reproducible example, I have the following Provisioning Template in my Foreman instance: 
 <pre><code><%# 
 %> -%> 
 content that will not be exported 
 <%= name @host.hostname %> 
 content that will be exported 
 </code></pre> 

 The output of both the API endpoint and the "export" button in the web UI is as follows: 
 <pre><code><%# 
 name: testing 
 snippet: false 
 model: ProvisioningTemplate 
 kind: script 
 -%> 
 content that will be exported% 
 </code></pre> 

 However, by either removing the ERB comment at the start of the file, or changing the expression printing tag to any other variable that does not contain 'name', other than @host.hostname, the export endpoints will export the full file as expected.  

 This is found on Foreman version 3.10.0 running on AlmaLinux 9.4. I receive the same file subset on both Firefox and curl.

Back