summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBrice Figureau <brice-puppet@daysofwonder.com>2008-11-19 10:10:54 +0100
committerJames Turnbull <james@lovedthanlost.net>2008-11-20 09:42:00 +1100
commit1ad33cc1499bc9c5fee89d921c219b06986c34b5 (patch)
treeaecb94ee07550824cbb8424c237e591cc0291b28 /lib
parentc96d250f71bbc75e0ababaeff3b7024bdb20ff60 (diff)
downloadpuppet-1ad33cc1499bc9c5fee89d921c219b06986c34b5.tar.gz
puppet-1ad33cc1499bc9c5fee89d921c219b06986c34b5.tar.xz
puppet-1ad33cc1499bc9c5fee89d921c219b06986c34b5.zip
Fix #1759 - Comparison operator was using string comparison for numbers
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/parser/ast/comparison_operator.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/puppet/parser/ast/comparison_operator.rb b/lib/puppet/parser/ast/comparison_operator.rb
index 63aa36c7f..3af86efea 100644
--- a/lib/puppet/parser/ast/comparison_operator.rb
+++ b/lib/puppet/parser/ast/comparison_operator.rb
@@ -18,6 +18,10 @@ class Puppet::Parser::AST
lval = @lval.safeevaluate(scope)
rval = @rval.safeevaluate(scope)
+ # convert to number if operands are number
+ lval = Puppet::Parser::Scope.number?(lval) || lval
+ rval = Puppet::Parser::Scope.number?(rval) || rval
+
# return result
unless @operator == '!='
lval.send(@operator,rval)