Here's a patch to make puppet do integer comparison instead of string 
comparison if both strings are valid integers:

--- OLD/site_ruby/1.8/puppet/provider/augeas/augeas.rb  2013-09-19 
14:09:52.000000000 -0400
+++ NEW/site_ruby/1.8/puppet/provider/augeas/augeas.rb  2013-09-19 
16:23:48.000000000 -0400
@@ -164,6 +164,10 @@
     end
   end
 
+  def is_numeric?(s)
+    s.to_s.match(/\A[+-]?\d+?(\.\d+)?\Z/) == nil ? false : true
+  end
+
   # Used by the need_to_run? method to process get filters. Returns
   # true if there is a match, false if otherwise
   # Assumes a syntax of get /files/path [COMPARATOR] value
@@ -179,10 +183,14 @@
 
     #check the value in augeas
     result = @aug.get(path) || ''
-    case comparator
-    when "!="
+
+    if comparator == "<" and is_numeric?(result) and is_numeric?(arg) 
+      return_value = result.to_s.to_f < arg.to_s.to_f
+    elsif comparator == ">" and is_numeric?(result) and is_numeric?(arg) 
+      return_value = result.to_s.to_f > arg.to_s.to_f
+    elsif comparator == "!="
       return_value = (result != arg)
-    when "=~"
+    elsif comparator == "=~"
       regex = Regexp.new(arg)
       return_value = (result =~ regex)
     else

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to