Bug #11601
When using host-specific parameters, the rendering preview in job invocation renders to false
Description
1. use a job template that uses some host parameters, such as:
<% if @host.operatingsystem.family == "Redhat" && @host.operatingsystem.major.to_i > 6 %> systemctl <%= input("action") %> <%= input("service") %> <% else %> service <%= input("service") %> <%= input("action") %> <% end -%>
2. invoke a job with this template
3. the job invocation details page has `false` in the the rendering output
expected:
ability to choose what host the preview to render against?
Associated revisions
History
#1
Updated by Stephen Benjamin almost 7 years ago
Oh thanks, I noticed that this morning and meant to file it. Foreman just passes an actual host to render its preview:
https://github.com/theforeman/foreman/blob/develop/app/controllers/templates_controller.rb#L83
I wonder if we just shouldn't provide a dummy object to it that converts any @host calls to something like `$HOST[operatingsystem][family]`
#2
Updated by Stephen Benjamin almost 7 years ago
Ah nevermind, that won't work, because the templates want some values to be able to render like an OS major and things.
#3
Updated by Marek Hulán almost 7 years ago
- Status changed from New to Assigned
- Assignee set to Marek Hulán
A quick workaround will be rendering the preview for first host we have. Later we can improve (adding select box or displaying to preview in hosts tab)
#4
Updated by The Foreman Bot almost 7 years ago
- Status changed from Assigned to Ready For Testing
- Target version set to 85
- Pull request https://github.com/theforeman/foreman_remote_execution/pull/27 added
- Pull request deleted (
)
#5
Updated by Marek Hulán almost 7 years ago
- Legacy Backlogs Release (now unused) set to 81
#6
Updated by Marek Hulán almost 7 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset foreman_plugin|bbee9e667a8173a82e8f7fa1cd61ec6bfc52b579.
Fixes #11601 - do the preview for specific host if possible