summaryrefslogtreecommitdiff
path: root/lib/chef/resource/cron.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/resource/cron.rb')
-rw-r--r--lib/chef/resource/cron.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/chef/resource/cron.rb b/lib/chef/resource/cron.rb
index 72f86bc974..0a29afd276 100644
--- a/lib/chef/resource/cron.rb
+++ b/lib/chef/resource/cron.rb
@@ -121,8 +121,12 @@ class Chef
converted_arg = arg
end
begin
- if !arg.is_a?(Symbol) && integerize(arg) > 7
- raise RangeError
+ error_message = "You provided '#{arg}' as a weekday, acceptable values are "
+ error_message << Provider::Cron::WEEKDAY_SYMBOLS.map {|sym| ":#{sym.to_s}"}.join(', ')
+ error_message << " and a string in crontab format"
+ if (arg.is_a?(Symbol) && !Provider::Cron::WEEKDAY_SYMBOLS.include?(arg)) ||
+ (!arg.is_a?(Symbol) && integerize(arg) > 7)
+ raise RangeError, error_message
end
rescue ArgumentError
end