Update more cookbooks

This commit is contained in:
Greg Karékinian
2017-06-16 11:25:49 +02:00
parent 7da2c5a738
commit f5858319a7
129 changed files with 1095 additions and 101571 deletions

View File

@@ -1,5 +1,5 @@
#
# Copyright 2016, Steven Danna
# Copyright:: 2016-2017, Steven Danna
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -17,20 +17,20 @@
resource_name :logrotate_app
property :path, [String, Array], required: true
property :frequency, String, default: "weekly"
property :cookbook, default: "logrotate"
property :template_name, default: "logrotate.erb"
property :template_mode, default: "0644"
property :template_owner, default: "root"
property :template_group, default: "root"
property :base_dir, String, default: "/etc/logrotate.d"
property :frequency, String, default: 'weekly'
property :cookbook, default: 'logrotate'
property :template_name, default: 'logrotate.erb'
property :template_mode, default: '0644'
property :template_owner, default: 'root'
property :template_group, default: 'root'
property :base_dir, String, default: '/etc/logrotate.d'
property :options, [Array, String], default: %w{missingok compress delaycompress copytruncate notifempty}
property :options, [Array, String], default: %w(missingok compress delaycompress copytruncate notifempty)
default_action :enable
CookbookLogrotate::SCRIPTS.each do |script_name|
property script_name.to_sym, coerce: Proc.new { |val| Array(val).join("\n") }
property script_name.to_sym, coerce: proc { |val| Array(val).join("\n") }
end
CookbookLogrotate::VALUES.each do |configurable_name|
@@ -42,15 +42,15 @@ property :sharedscripts, [TrueClass, FalseClass], default: false
property :enable, [TrueClass, FalseClass], default: true
action :enable do
if !new_resource.enable
Chef::Log.deprecation "Use `action :disable` rather than `enable false` in the logrotate_app resource"
unless new_resource.enable
Chef::Log.deprecation 'Use `action :disable` rather than `enable false` in the logrotate_app resource'
action_disable
return true
end
logrotate_config = {
# The path should be a space separated list of quoted filesystem paths
path: Array(new_resource.path).map { |path| path.to_s.inspect }.join(" "),
path: Array(new_resource.path).map { |path| path.to_s.inspect }.join(' '),
frequency: new_resource.frequency,
directives: handle_options(new_resource),
scripts: handle_scripts(new_resource),
@@ -58,9 +58,9 @@ action :enable do
}
directory new_resource.base_dir do
owner "root"
group node["root_group"]
mode "0755"
owner 'root'
group node['root_group']
mode '0755'
action :create
end
@@ -84,7 +84,7 @@ end
def handle_configurables(new_resource)
configurables = {}
CookbookLogrotate::VALUES.each do |opt_name|
if value = new_resource.send(opt_name.to_sym)
if value = new_resource.send(opt_name.to_sym) # rubocop: disable Lint/AssignmentInCondition
configurables[opt_name] = value
end
end
@@ -94,7 +94,7 @@ end
def handle_scripts(new_resource)
scripts = {}
CookbookLogrotate::SCRIPTS.each do |script_name|
if script_body = new_resource.send(script_name.to_sym)
if script_body = new_resource.send(script_name.to_sym) # rubocop: disable Lint/AssignmentInCondition
scripts[script_name] = script_body
end
end
@@ -109,8 +109,8 @@ def handle_options(new_resource)
end
if new_resource.sharedscripts
Chef::Log.deprecation("The sharedscripts resource property is deprecated. Use the options property instead to set this value")
opts << "sharedscripts"
Chef::Log.deprecation('The sharedscripts resource property is deprecated. Use the options property instead to set this value')
opts << 'sharedscripts'
end
opts
end