Project

General

Profile

Actions

Feature #15371

open

Provide OS detection macros for (job) templates

Added by Marek Hulán over 8 years ago. Updated over 8 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Foreman
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

We should provide some built-in helper for os detection. One repeating pattern in all templates is following

<% if @host.operatingsystem.family == 'Redhat' -%>
  yum -y <%= input("action") %> <%= input("package") %>
<% elsif @host.operatingsystem.family == 'Debian' -%>
  apt-get -y <%= input("action") %> <%= input("package") %>
<% end -%>

we could either introduce new os_family macro or add something like

<% on_family(:debian) do
  ...
end %>

I'm afraid ERB might have issues with the later unless to block is closed in the first erb tag


Related issues 1 (0 open1 closed)

Related to Foreman Remote Execution - Feature #8142: As a user I would like remote command scripts to leverage smart variablesRejectedActions
Actions

Also available in: Atom PDF