Debian Codegraph @

templates/etc/logrotate.d/rule.erb

raw
1 <%
2 opts = []
3
4 if @path.kind_of?(Array)
5 rpath = @path.join(' ')
6 else
7 rpath = @path
8 end
9
10 if scope.to_hash.has_key?('_create')
11 if @_create == 'create'
12 opts << [@_create, @create_mode, @create_owner, @create_group].reject { |r|
13 r == 'undef'
14 }.join(' ')
15 else
16 opts << @_create
17 end
18 end
19
20 [
21 '_compress', '_copy', '_copytruncate', '_delaycompress', '_dateext',
22 '_mail', '_missingok', '_olddir', '_sharedscripts', '_ifempty', '_maillast',
23 '_mailfirst', '_shred', '_rotate_every'
24 ].each do |bool|
25 opts << scope.to_hash[bool] if scope.to_hash.has_key?(bool)
26 end
27
28 [
29 'compresscmd', 'compressext', 'compressoptions', 'dateformat', 'extension',
30 'maxage', 'minsize', 'rotate', 'size', 'shredcycles', 'start',
31 'uncompresscmd'
32 ].each do |key|
33 value = scope.to_hash[key]
34 opts << "#{key} #{value}" if value != 'undef'
35 end
36 -%>
37 <%= rpath %> {
38 <% opts.each do |opt| -%>
39 <%= opt %>
40 <% end -%>
41 <% if @postrotate != 'undef' -%>
42 postrotate
43 <%= @postrotate %>
44 endscript
45 <% end -%>
46 <% if @prerotate != 'undef' -%>
47 prerotate
48 <%= @prerotate %>
49 endscript
50 <% end -%>
51 <% if @firstaction != 'undef' -%>
52 firstaction
53 <%= @firstaction %>
54 endscript
55 <% end -%>
56 <% if @lastaction != 'undef' -%>
57 lastaction
58 <%= @lastaction %>
59 endscript
60 <% end -%>
61 }