diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-03-23 19:48:14 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-03-23 20:10:35 -0700 |
commit | 3116f5a5dc8d80216e2c28e1be52c97e7eb4da8c (patch) | |
tree | 2276b6bb5e897014f721cab8453caf8c8b50361f /lib/chef | |
parent | 9745b76aaa950d035fe6c0c6bbc1f13b99ec79ae (diff) | |
download | chef-3116f5a5dc8d80216e2c28e1be52c97e7eb4da8c.tar.gz |
Validate that splay values are positive
Add some tests for this and fix the naming of other tests
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/chef')
-rw-r--r-- | lib/chef/resource/chef_client_cron.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/chef/resource/chef_client_cron.rb b/lib/chef/resource/chef_client_cron.rb index e4ed4bca8f..f90575c7f0 100644 --- a/lib/chef/resource/chef_client_cron.rb +++ b/lib/chef/resource/chef_client_cron.rb @@ -93,6 +93,8 @@ class Chef property :splay, [Integer, String], default: 300, + coerce: proc { |x| Integer(x) }, + callbacks: { "should be a positive number" => proc { |v| v > 0 } }, description: "A random number of seconds between 0 and X to add to interval so that all #{Chef::Dist::CLIENT} commands don't execute at the same time." property :environment, Hash, @@ -123,7 +125,7 @@ class Chef description: "The path to the #{Chef::Dist::CLIENT} binary." property :daemon_options, Array, - default: [], + default: lazy { [] }, description: "An array of options to pass to the #{Chef::Dist::CLIENT} command." action :add do |