diff --git a/lib/puppet/parser/functions/min.rb b/lib/puppet/parser/functions/min.rb index a2ec99f44..712902dc3 100644 --- a/lib/puppet/parser/functions/min.rb +++ b/lib/puppet/parser/functions/min.rb @@ -13,8 +13,11 @@ module Puppet::Parser::Functions # Sometimes we get numbers as numerics and sometimes as strings. # We try to compare them as numbers when possible return args.min do |a, b| - a.to_f <=> b.to_f if a.to_s =~ %r{\A^-?\d+(.\d+)?\z} && b.to_s =~ %r{\A-?\d+(.\d+)?\z} - a.to_s <=> b.to_s + if a.to_s =~ %r{\A^-?\d+(.\d+)?\z} && b.to_s =~ %r{\A-?\d+(.\d+)?\z} + a.to_f <=> b.to_f + else + a.to_s <=> b.to_s + end end end end