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
Updated by Marek Hulán over 8 years ago
- Related to Feature #8142: As a user I would like remote command scripts to leverage smart variables added
Updated by Marek Hulán over 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