summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYolanda Robla <yolanda.robla-mota@hp.com>2015-08-14 18:02:45 +0200
committerYolanda Robla <yolanda.robla-mota@hp.com>2015-08-14 18:03:58 +0200
commitf9f02e47d4b768e767a0516841ed4164a12081ae (patch)
treea8f7ffd9f11acfe8fa30be3c4d70341a25e20351
parenta94f0895357762085e274bba44d8f497a9252562 (diff)
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
Notes
Notes (review): Code-Review+2: Monty Taylor <mordred@inaugust.com> Workflow+1: Monty Taylor <mordred@inaugust.com> Verified+2: Jenkins Code-Review+2: Spencer Krum <nibz@spencerkrum.com> Submitted-by: Jenkins Submitted-at: Sun, 16 Aug 2015 11:57:53 +0000 Reviewed-on: https://review.openstack.org/213221 Project: openstack-infra/puppet-logrotate Branch: refs/heads/master
-rw-r--r--templates/config.erb36
1 files changed, 24 insertions, 12 deletions
diff --git a/templates/config.erb b/templates/config.erb
index 619c299..0a14d43 100644
--- a/templates/config.erb
+++ b/templates/config.erb
@@ -2,23 +2,35 @@
2<% @options.each do |opt| -%> <%= opt %> 2<% @options.each do |opt| -%> <%= opt %>
3<% end -%> 3<% end -%>
4<% if @prerotate != 'undef' -%> 4<% if @prerotate != 'undef' -%>
5 prerotate 5 prerotate
6 <%= @prerotate %> 6 <%- @prerotate = [@prerotate] unless @prerotate.is_a?(Array) -%>
7 endscript 7 <%- @prerotate.each do |val| -%>
8 <%= val %>
9 <%- end -%>
10 endscript
8<% end -%> 11<% end -%>
9<% if @postrotate != 'undef' -%> 12<% if @postrotate != 'undef' -%>
10 postrotate 13 postrotate
11 <%= @postrotate %> 14 <%- @postrotate = [@postrotate] unless @postrotate.is_a?(Array) -%>
12 endscript 15 <%- @postrotate.each do |val| -%>
16 <%= val %>
17 <%- end -%>
18 endscript
13<% end -%> 19<% end -%>
14<% if @firstaction != 'undef' -%> 20<% if @firstaction != 'undef' -%>
15 firstaction 21 firstaction
16 <%= @firstaction %> 22 <%- @firstaction = [@firstaction] unless @firstaction.is_a?(Array) -%>
17 endscript 23 <%- @firstaction.each do |val| -%>
24 <%= val %>
25 <%- end -%>
26 endscript
18<% end -%> 27<% end -%>
19<% if @lastaction != 'undef' -%> 28<% if @lastaction != 'undef' -%>
20 lastaction 29 lastaction
21 <%= @lastaction %> 30 <%- @lastaction = [@lastaction] unless @lastaction.is_a?(Array) -%>
22 endscript 31 <%- @lastaction.each do |val| -%>
32 <%= val %>
33 <%- end -%>
34 endscript
23<% end -%> 35<% end -%>
24} 36}