summaryrefslogtreecommitdiff
path: root/lib/puppet/parser/functions/validate_slength.rb
AgeCommit message (Collapse)Author
2013-08-12(maint) Validate input argument in a single locationAdrien Thebo
2013-08-12(maint) reindent case statement to match standard indentationAdrien Thebo
2013-08-12(maint) collapse String/Array validation into shared lambdaAdrien Thebo
2013-08-12(maint) clean up validate_slength argument validationAdrien Thebo
2013-08-12(maint) reword error messages for validate_slengthAdrien Thebo
2013-08-12(maint) Explicitly unpack validate_slength argsAdrien Thebo
2013-08-12(maint) Remove unneeded parens around exceptionsAdrien Thebo
2013-08-08Fix validate_slength, arg.length should be args[0].lengthHubert
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>
2013-08-06changed the validate_slength function to accept a min lengthMartin Hellmich
An optional third parameter can be given a min length. The function then only passes successfully, if all strings are in the range min_length <= string <= max_length update and fix function and unit tests the check for the minlength has to be written differently because 0 values should be possible. We now check a) if the input is convertible, and throw a ParseError and b) if the input .is_a?(Numeric) and ask for a positive number it's not as clean as for maxlength, but keeps a similar behaviour refined the error checking for the min length try to convert to Integer(args[2]) and fail, if it's not possible changed the tests accordingly to the new parameter checking
2012-02-22(#12776) Added validate_slength function and rspec testChris Spence
This function is used to validate a string is less than a maximum length. The string, or array of strings, is passed as the first argument to the function. The maximum length of the string is passed as the second argument. It is useful to validate, for example, that Puppet is not sending a username to a downstream system that the system cannot cope with, but that might not cause an error message - for example, MySQL will not accept a username of more than 16 characters. This enables a Puppet administrator to validate the data that it may have been passed from upstream through, for example, Hiera.