Project

General

Profile

Actions

Bug #11601

closed

When using host-specific parameters, the rendering preview in job invocation renders to false

Added by Ivan Necas about 9 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

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?

Actions #1

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]`

Actions #2

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.

Actions #3

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)

Actions #4

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 ()
Actions #5

Updated by Marek Hulán about 9 years ago

  • Translation missing: en.field_release set to 81
Actions #6

Updated by Marek Hulán about 9 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF