]> gitweb.fluxo.info Git - puppet-stdlib.git/commitdiff
Fix validate_slength, arg.length should be args[0].length
authorHubert <h.deheer@gmail.com>
Thu, 8 Aug 2013 10:56:12 +0000 (12:56 +0200)
committerHubert <h.deheer@gmail.com>
Thu, 8 Aug 2013 10:56:12 +0000 (12:56 +0200)
During a puppet run an error will be thrown and a puppet run will fail completely (when using validate_slength):
undefined local variable or method `arg' for #<Puppet::Parser::Scope:0x7f243c236948>

lib/puppet/parser/functions/validate_slength.rb

index e0ba43b55d6c5b87ea9ae46e9fa9ce88ce29fd82..339a21d1f27c71103dc950e530d2535b331555bb 100644 (file)
@@ -49,7 +49,7 @@ module Puppet::Parser::Functions
 
     case args[0]
       when String
-        raise Puppet::ParseError, ("validate_slength(): #{args[0].inspect} is #{args[0].length} characters.  It should have been between #{min_length} and #{max_length} characters") unless args[0].length <= max_length and min_length <= arg.length
+        raise Puppet::ParseError, ("validate_slength(): #{args[0].inspect} is #{args[0].length} characters.  It should have been between #{min_length} and #{max_length} characters") unless args[0].length <= max_length and min_length <= args[0].length
       when Array
         args[0].each do |arg|
           if arg.is_a?(String)