Update logrotate cookbook
This commit is contained in:
@@ -19,18 +19,18 @@
|
||||
|
||||
# Helper module for Logrotate configuration module CookbookLogrotate
|
||||
module CookbookLogrotate
|
||||
DIRECTIVES = %w(compress copy copytruncate daily dateext
|
||||
DIRECTIVES = %w{compress copy copytruncate daily dateext
|
||||
dateyesterday delaycompress hourly ifempty mailfirst maillast
|
||||
missingok monthly nocompress nocopy nocopytruncate nocreate
|
||||
missingok monthly nocompress nocopy nocopytruncate nocreate nocreateolddir
|
||||
nodelaycompress nodateext nomail nomissingok noolddir
|
||||
nosharedscripts noshred notifempty sharedscripts shred weekly
|
||||
yearly) unless const_defined?(:DIRECTIVES)
|
||||
nosharedscripts noshred notifempty renamecopy sharedscripts shred weekly
|
||||
yearly} unless const_defined?(:DIRECTIVES)
|
||||
|
||||
VALUES = %w(compresscmd uncompresscmd compressext compressoptions
|
||||
create dateformat include mail extension maxage minsize maxsize
|
||||
rotate size shredcycles start tabooext su olddir) unless const_defined?(:VALUES)
|
||||
VALUES = %w{compresscmd uncompresscmd compressext compressoptions
|
||||
create createolddir dateformat include mail extension maxage minsize maxsize
|
||||
rotate size shredcycles start tabooext su olddir} unless const_defined?(:VALUES)
|
||||
|
||||
SCRIPTS = %w(firstaction prerotate postrotate lastaction preremove) unless const_defined?(:SCRIPTS)
|
||||
SCRIPTS = %w{firstaction prerotate postrotate lastaction preremove} unless const_defined?(:SCRIPTS)
|
||||
|
||||
DIRECTIVES_AND_VALUES = DIRECTIVES + VALUES unless const_defined?(:DIRECTIVES_AND_VALUES)
|
||||
|
||||
@@ -52,11 +52,11 @@ module CookbookLogrotate
|
||||
end
|
||||
|
||||
def paths_from(hash)
|
||||
hash.select { |k| !(DIRECTIVES_AND_VALUES.include?(k)) }.reduce({}) do | accum_paths, (path, config) |
|
||||
hash.select { |k| !(DIRECTIVES_AND_VALUES.include?(k)) }.reduce({}) do |accum_paths, (path, config)|
|
||||
accum_paths[path] = {
|
||||
'directives' => directives_from(config),
|
||||
'values' => values_from(config),
|
||||
'scripts' => scripts_from(config)
|
||||
"directives" => directives_from(config),
|
||||
"values" => values_from(config),
|
||||
"scripts" => scripts_from(config),
|
||||
}
|
||||
|
||||
accum_paths
|
||||
@@ -65,7 +65,7 @@ module CookbookLogrotate
|
||||
|
||||
def scripts_from(hash)
|
||||
defined_scripts = hash.select { |k| SCRIPTS.include?(k) }
|
||||
defined_scripts.reduce({}) do | accum_scripts, (script, lines) |
|
||||
defined_scripts.reduce({}) do |accum_scripts, (script, lines)|
|
||||
if lines.respond_to?(:join)
|
||||
accum_scripts[script] = lines.join("\n")
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user