Bug #11601
closedWhen 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?
Updated by Stephen Benjamin about 9 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]`
Updated by Stephen Benjamin about 9 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.
Updated by Marek Hulán about 9 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)
Updated by The Foreman Bot about 9 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 (
)
Updated by Marek Hulán about 9 years ago
- Translation missing: en.field_release set to 81
Updated by Marek Hulán about 9 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset foreman_plugin|bbee9e667a8173a82e8f7fa1cd61ec6bfc52b579.