summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2018-08-27 09:46:36 -0700
committerGitHub <noreply@github.com>2018-08-27 09:46:36 -0700
commitcdf0448ecf63ee99e3f2a5f0002dae4de5f0f5b7 (patch)
tree441b46d8688c51a98219cf0e1146884093b10355
parent76e8920cd7b920b764e187afde2dfd663ca3f9b2 (diff)
parent2eb42a6ee467e054d2f61d3871fd688eec17087f (diff)
downloadchef-cdf0448ecf63ee99e3f2a5f0002dae4de5f0f5b7.tar.gz
Merge pull request #7589 from chef/random_delay
cron_d: Add random_delay and cleanup properties
-rw-r--r--lib/chef/resource/cron_d.rb19
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/chef/resource/cron_d.rb b/lib/chef/resource/cron_d.rb
index ba78008ab8..63d168d16a 100644
--- a/lib/chef/resource/cron_d.rb
+++ b/lib/chef/resource/cron_d.rb
@@ -135,29 +135,32 @@ class Chef
description: "The user to run the cron job as.",
default: "root"
- property :mailto, [String, NilClass],
+ property :mailto, String,
description: "Set the MAILTO environment variable in the cron.d file."
- property :path, [String, NilClass],
+ property :path, String,
description: "Set the PATH environment variable in the cron.d file."
- property :home, [String, NilClass],
+ property :home, String,
description: "Set the HOME environment variable in the cron.d file."
- property :shell, [String, NilClass],
- description: "Set the HOME environment variable in the cron.d file."
+ property :shell, String,
+ description: "Set the SHELL environment variable in the cron.d file."
- property :comment, [String, NilClass],
+ property :comment, String,
description: "A comment to place in the cron.d file."
property :environment, Hash,
description: "A Hash containing additional arbitrary environment variables under which the cron job will be run.",
- default: {}
+ default: lazy { Hash.new }
property :mode, [String, Integer],
description: "The octal mode of the generated crontab file.",
default: "0600"
+ property :random_delay, Integer,
+ description: "Set the RANDOM_DELAY environment variable in the cron.d file."
+
# warn if someone passes the deprecated cookbook property
def after_created
raise ArgumentError, "The 'cookbook' property for the cron_d resource is no longer supported now that this resource ships in Chef itself." if new_resource.cookbook
@@ -190,6 +193,7 @@ class Chef
end
action_class do
+ # @return [String] cron_name property with . replaced with -
def sanitized_name
new_resource.cron_name.tr(".", "-")
end
@@ -222,6 +226,7 @@ class Chef
home: new_resource.home,
shell: new_resource.shell,
comment: new_resource.comment,
+ random_delay: new_resource.random_delay,
environment: new_resource.environment
)
action create_action