From 29925fb28a09075ea4c4105674dca2415e1c7800 Mon Sep 17 00:00:00 2001 From: Dorin Pleava Date: Thu, 6 Aug 2020 15:14:37 +0300 Subject: (MODULES-7786) Allow leading zeroes for cron params When applying a cron manigest that contains leading zeroes in a periodic attribute (hour, minute, month, monthday, weekday), puppet will strip down the zeroes even if they are accepted by the system cron. Now puppet will only convert to integer the periodic attributes when validating them, but will not change the input from the manifest. --- lib/puppet/type/cron.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'lib/puppet') diff --git a/lib/puppet/type/cron.rb b/lib/puppet/type/cron.rb index d590a16..186a5e7 100644 --- a/lib/puppet/type/cron.rb +++ b/lib/puppet/type/cron.rb @@ -73,9 +73,7 @@ Puppet::Type.newtype(:cron) do # in string form to actual integers, and returns the value if it's # an integer or false if it's just a normal string. def numfix(num) - if num =~ %r{^\d+$} - num.to_i - elsif num.is_a?(Integer) + if num =~ %r{^\d+$} || num.is_a?(Integer) num else false @@ -85,7 +83,7 @@ Puppet::Type.newtype(:cron) do # Verify that a number is within the specified limits. Return the # number if it is, or false if it is not. def limitcheck(num, lower, upper) - (num >= lower && num <= upper) && num + (num.to_i >= lower && num.to_i <= upper) && num end # Verify that a value falls within the specified array. Does case -- cgit v1.2.3