Commit 107fd11f authored by Tim Smith's avatar Tim Smith
Browse files

Simplify how we validate the predfined_value property

We don't need callbacks to do this. Chef has it out of the box
Signed-off-by: default avatarTim Smith <>
parent 698c20cd
class Cron
class Helpers
def self.validate_predefined_value(spec)
# Several special predefined values can substitute in the cron expression
spec.nil? ||
def self.validate_numeric(spec, min, max)
return true if spec == '*'
# binding.pry
......@@ -20,12 +20,7 @@
require 'shellwords'
property :cookbook, String, default: 'cron'
property :predefined_value, [String], callbacks: {
'should be a valid predefined value' => lambda do |spec|
property :predefined_value, String, equal_to: %w( @reboot @yearly @annually @monthly @weekly @daily @midnight @hourly )
property :minute, [Integer, String], default: '*', callbacks: {
'should be a valid minute spec' => lambda do |spec|
::Cron::Helpers.validate_numeric(spec, 0, 59)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment