Skip to content

Commit

Permalink
[COOK-3141] Do not duplicate template entires for multiple paths
Browse files Browse the repository at this point in the history
  • Loading branch information
sethvargo committed Oct 4, 2013
1 parent 6ef5d05 commit f56b1c7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions definitions/logrotate_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
include_recipe 'logrotate::default'

acceptable_options = ['missingok', 'compress', 'delaycompress', 'dateext', 'copytruncate', 'notifempty', 'delaycompress', 'ifempty', 'mailfirst', 'nocompress', 'nocopy', 'nocopytruncate', 'nocreate', 'nodelaycompress', 'nomail', 'nomissingok', 'noolddir', 'nosharedscripts', 'notifempty', 'sharedscripts']
path = Array(params[:path])
options_tmp = params[:options] ||= ["missingok", "compress", "delaycompress", "copytruncate", "notifempty"]
options = options_tmp.respond_to?(:each) ? options_tmp : options_tmp.split

Expand All @@ -54,7 +53,7 @@
group params[:template_group]
backup false
variables(
:path => path,
:path => Array(params[:path]).map { |path| %Q(#{path}).inspect }.join(' '),
:create => params[:create],
:frequency => params[:frequency],
:size => params[:size],
Expand Down
8 changes: 4 additions & 4 deletions templates/default/logrotate.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Generated by Chef for <%= node['fqdn'] %>
<% @path.each do |p| -%>
<%= p %> {
# This file was generated by Chef for <%= node['fqdn'] %>.
# Do not modify this file by hand!

<%= @path %> {
<%- if @frequency %>
<%= @frequency %>
<%- end %>
Expand Down Expand Up @@ -46,4 +47,3 @@
endscript
<%- end %>
}
<%- end %>

0 comments on commit f56b1c7

Please sign in to comment.