Project

General

Profile

Actions

Feature #15371

open

Provide OS detection macros for (job) templates

Added by Marek Hulán almost 8 years ago. Updated almost 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 #1

Updated by Marek Hulán almost 8 years ago

  • Related to Feature #8142: As a user I would like remote command scripts to leverage smart variables added
Actions #2

Updated by Ivan Necas almost 8 years ago

Shouldn't this go to foreman core?

Actions #3

Updated by Marek Hulán almost 8 years ago

Probably yes but I think it would be better to have bunch of useful helpers first so we can say this is the API that won't change too much.

Actions

Also available in: Atom PDF