Skip to content
Snippets Groups Projects
Commit c902b017 authored by Russ Allbery's avatar Russ Allbery
Browse files

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.
parent 6654b270
No related branches found
No related tags found
No related merge requests found
...@@ -15,14 +15,14 @@ set archive = <%= archive %>/%Y/%M/%d/%m.%n ...@@ -15,14 +15,14 @@ set archive = <%= archive %>/%Y/%M/%d/%m.%n
<% if stop != '' || restart != '' then -%> <% if stop != '' || restart != '' then -%>
<% end -%> <% end -%>
<% logs.each do |log| -%> <% [logs].flatten.each do |log| -%>
<% log_name = log.gsub(/[\.\-\<\>]/, '_') -%> <% log_name = log.gsub(/[\.\-\<\>]/, '_') -%>
<% path = directory + '/' + log -%> <% path = directory + '/' + log -%>
<% perms = [log_owner, log_group, log_mode].join(' ') -%> <% perms = [log_owner, log_group, log_mode].join(' ') -%>
log: <%= log_name %> <%= path %> <%= perms %> log: <%= log_name %> <%= path %> <%= perms %>
<% end -%> <% end -%>
<% logs.each do |log| -%> <% [logs].flatten.each do |log| -%>
<% log_name = log.gsub(/[\.\-\<\>]/, '_') -%> <% log_name = log.gsub(/[\.\-\<\>]/, '_') -%>
archive: <%= log_name %> save <%= save_num %> archive: <%= log_name %> save <%= save_num %>
<% if archive != '' then -%> <% if archive != '' then -%>
...@@ -32,7 +32,7 @@ set archive = <%= archive %>/%Y/%M/%d/%m.%n ...@@ -32,7 +32,7 @@ set archive = <%= archive %>/%Y/%M/%d/%m.%n
<% if analyze != '' then -%> <% if analyze != '' then -%>
<% alogs = analyze_logs.to_a.empty? ? logs : analyze_logs -%> <% alogs = analyze_logs.to_a.empty? ? logs : analyze_logs -%>
<% alogs.each do |log| -%> <% [alogs].flatten.each do |log| -%>
<% log_name = log.gsub(/[\.\-\<\>]/, '_') -%> <% log_name = log.gsub(/[\.\-\<\>]/, '_') -%>
analyze: <%= log_name %> <%= analyze %> analyze: <%= log_name %> <%= analyze %>
<% end -%> <% end -%>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment