Actions
Feature #15371
openProvide OS detection macros for (job) templates
Status:
New
Priority:
Normal
Assignee:
-
Category:
Foreman
Target version:
-
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
Actions