Allow logrotation actions to be string or array

For prerotate, logrotate, firstaction and lastaction
is very common to need several lines of commands, making
it difficult to pass with a puppet string.
Allow this parameter to be either and string or an array
to allow this usage.

Change-Id: I7451ecc550b50b85c55784ef598f6b45412117fc
This commit is contained in:
Yolanda Robla 2015-08-14 18:02:45 +02:00
parent a94f089535
commit f9f02e47d4
1 changed files with 24 additions and 12 deletions

View File

@ -2,23 +2,35 @@
<% @options.each do |opt| -%> <%= opt %>
<% end -%>
<% if @prerotate != 'undef' -%>
prerotate
<%= @prerotate %>
endscript
prerotate
<%- @prerotate = [@prerotate] unless @prerotate.is_a?(Array) -%>
<%- @prerotate.each do |val| -%>
<%= val %>
<%- end -%>
endscript
<% end -%>
<% if @postrotate != 'undef' -%>
postrotate
<%= @postrotate %>
endscript
postrotate
<%- @postrotate = [@postrotate] unless @postrotate.is_a?(Array) -%>
<%- @postrotate.each do |val| -%>
<%= val %>
<%- end -%>
endscript
<% end -%>
<% if @firstaction != 'undef' -%>
firstaction
<%= @firstaction %>
endscript
firstaction
<%- @firstaction = [@firstaction] unless @firstaction.is_a?(Array) -%>
<%- @firstaction.each do |val| -%>
<%= val %>
<%- end -%>
endscript
<% end -%>
<% if @lastaction != 'undef' -%>
lastaction
<%= @lastaction %>
endscript
lastaction
<%- @lastaction = [@lastaction] unless @lastaction.is_a?(Array) -%>
<%- @lastaction.each do |val| -%>
<%= val %>
<%- end -%>
endscript
<% end -%>
}