Katello Ansible Errata job template starts with spaces before --- breaking the template

Problem:
the default katello errata ansible job template gets rendered with spaces before first character due to the code in the template being indented.
This breaks the job due to it being an invalid yaml.
Editing the template and removing indentation fixes the problem, but you guys must have a better fix and/or fix it upstream so it doesn’t get overwritten every update

Expected outcome:
No spaces

Foreman and Proxy versions:
Katello 4.10
Foreman 3.8

Foreman and Proxy plugin versions:

Distribution and version:

Other relevant data:

@jeremylenz @Bernhard_Suttner could this be introduced by Fixes #36075 - improve errata installation templates (#10444) · Katello/katello@c9c15fa · GitHub?

Looks like that’s possible.

I was wondering why this indentation broke things, while we have indentation on other lines that seems to be fine. I’m guessing it’s because we indented the line starting with <%= render_template which uses <%= (“execute the ruby and add the return value to the rendered template” rather than <% (“just execute the ruby”). Maybe it just throws out the whole line and doesn’t render leading whitespace if you use <%.

Created Bug #36994: Katello Ansible Errata job template starts with spaces before — breaking the template - Katello - Foreman

2 Likes

<%= … means "execute ... and replace the <> with the result.
<% … just means “execute”.

So yeah, there will be differences :slight_smile:

@birkirf

Can you share the rendered template so that we are sure, which line of code may broke something?

@evgeni Yes, can be. Maybe this line: Fixes #36075 - improve errata installation templates (#10444) · Katello/katello@c9c15fa · GitHub