diff options
author | Tim Smith <tsmith@chef.io> | 2020-03-23 13:43:29 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-23 13:43:29 -0700 |
commit | c541a451b092f356aefd1eed9027a305e37a2e8a (patch) | |
tree | d2038a70f91f98cf63f05a6c20e4d234ab4e6134 | |
parent | bdbe7e593265595b311870fe581f1ffe93078170 (diff) | |
download | chef-c541a451b092f356aefd1eed9027a305e37a2e8a.tar.gz |
Update lib/chef/mixin/cron_validations.rb
Signed-off-by: Tim Smith <tsmith@chef.io>
Co-Authored-By: pete higgins <pete@peterhiggins.org>
-rw-r--r-- | lib/chef/mixin/cron_validations.rb | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/lib/chef/mixin/cron_validations.rb b/lib/chef/mixin/cron_validations.rb index df5540436a..0723560e45 100644 --- a/lib/chef/mixin/cron_validations.rb +++ b/lib/chef/mixin/cron_validations.rb @@ -66,19 +66,9 @@ class Chef # @param spec the value to validate # @return [Boolean] valid or not? def self.validate_dow(spec) - return true if spec == "*" - - if spec.respond_to? :to_int - validate_numeric(spec, 0, 7) - elsif spec.respond_to? :to_str - # Named abbreviations are permitted but not as part of a range or with stepping - return true if %w{sun mon tue wed thu fri sat}.include? spec.downcase - - # 0-7 are legal for days of week - validate_numeric(spec, 0, 7) - else - false - end + return spec == "*" || + validate_numeric(spec, 0, 7) || + %w{sun mon tue wed thu fri sat}.include?(String(spec).downcase) end end end |