aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGabriel Nagy <gabrielnagy@me.com>2020-08-10 19:53:07 +0300
committerGitHub <noreply@github.com>2020-08-10 19:53:07 +0300
commitec2da07371008375ee809db02ad9be0d6d7090af (patch)
treead4a5ceeadc4d8b6e01b12c81bc4d8d94ae638a3 /lib
parent7cc67bf30ca7462ab9be0142673b27e271dcb258 (diff)
parent29925fb28a09075ea4c4105674dca2415e1c7800 (diff)
downloadpuppet-cron_core-ec2da07371008375ee809db02ad9be0d6d7090af.tar.gz
puppet-cron_core-ec2da07371008375ee809db02ad9be0d6d7090af.tar.bz2
Merge pull request #35 from Dorin-Pleava/MODULES-7786/Cron_accept_leading_zeros
(MODULES-7786) Allow leading zeroes for cron params
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/type/cron.rb6
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