diff options
author | Dorin Pleava <dorin.pleava@puppet.com> | 2020-08-06 15:14:37 +0300 |
---|---|---|
committer | Dorin Pleava <dorin.pleava@puppet.com> | 2020-08-10 15:44:35 +0300 |
commit | 29925fb28a09075ea4c4105674dca2415e1c7800 (patch) | |
tree | ad4a5ceeadc4d8b6e01b12c81bc4d8d94ae638a3 /lib | |
parent | 7cc67bf30ca7462ab9be0142673b27e271dcb258 (diff) | |
download | puppet-cron_core-29925fb28a09075ea4c4105674dca2415e1c7800.tar.gz puppet-cron_core-29925fb28a09075ea4c4105674dca2415e1c7800.tar.bz2 |
(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.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/type/cron.rb | 6 |
1 files changed, 2 insertions, 4 deletions
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 |