diff options
author | Tim Smith <tsmith@chef.io> | 2018-08-24 21:45:19 -0700 |
---|---|---|
committer | Tim Smith <tsmith@chef.io> | 2018-08-24 21:45:19 -0700 |
commit | f48755b6874735e63205e5d7da8f0b4501d1ad4e (patch) | |
tree | 955ed24a473a53dac7c0b722a8238ef3b469fbd3 | |
parent | 07f5d698331a6e2042f45c9d5dcf30aef5b428c6 (diff) | |
download | chef-f48755b6874735e63205e5d7da8f0b4501d1ad4e.tar.gz |
Lazily eval the empty hash default and remove nil types
We don't need to specify nil anymore since it's the default now.
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r-- | lib/chef/resource/cron_d.rb | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/chef/resource/cron_d.rb b/lib/chef/resource/cron_d.rb index 5dacc88fd4..caab0a4b7b 100644 --- a/lib/chef/resource/cron_d.rb +++ b/lib/chef/resource/cron_d.rb @@ -135,24 +135,24 @@ 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], + property :shell, String, description: "Set the HOME 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.", @@ -193,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 |