From c902b01755b35838d6fbab3308891333d7631100 Mon Sep 17 00:00:00 2001
From: Russ Allbery <rra@stanford.edu>
Date: Tue, 9 Jul 2013 14:32:02 -0700
Subject: [PATCH] Support passing newsyslog::config logs as a string

Allow logs to be set to a single log as a string by coercing logs
to a flattened array.  Do the same for the analyze_logs parameter.
---
 templates/newsyslog/config.erb | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/templates/newsyslog/config.erb b/templates/newsyslog/config.erb
index 721d342..4d0bee1 100644
--- a/templates/newsyslog/config.erb
+++ b/templates/newsyslog/config.erb
@@ -15,14 +15,14 @@ set archive = <%= archive %>/%Y/%M/%d/%m.%n
 <% if stop != '' || restart != '' then -%>
 
 <% end -%>
-<% logs.each do |log|                                       -%>
+<% [logs].flatten.each do |log|                             -%>
 <%   log_name = log.gsub(/[\.\-\<\>]/, '_')                 -%>
 <%   path     = directory + '/' + log                       -%>
 <%   perms    = [log_owner, log_group, log_mode].join(' ')  -%>
     log: <%= log_name %> <%= path %> <%= perms %>
 <% end                                                      -%>
 
-<% logs.each do |log|                                       -%>
+<% [logs].flatten.each do |log|                             -%>
 <%   log_name = log.gsub(/[\.\-\<\>]/, '_')                 -%>
     archive: <%= log_name %> save <%= save_num %>
 <%   if archive != '' then                                  -%>
@@ -32,7 +32,7 @@ set archive = <%= archive %>/%Y/%M/%d/%m.%n
 <% if analyze != '' then                                    -%>
 
 <%   alogs = analyze_logs.to_a.empty? ? logs : analyze_logs -%>
-<%   alogs.each do |log|                                    -%>
+<%   [alogs].flatten.each do |log|                          -%>
 <%     log_name = log.gsub(/[\.\-\<\>]/, '_')               -%>
     analyze: <%= log_name %> <%= analyze %>
 <%   end                                                    -%>
-- 
GitLab