4 module Puppet::Parser::Functions
5 newfunction(:validate_bool, :doc => <<-'DOC') do |args|
6 Validate that all passed values are either true or false. Abort catalog
7 compilation if any value fails this check.
9 The following values will pass:
13 validate_bool(true, true, false, $iamtrue)
15 The following values will fail, causing compilation to abort:
17 $some_array = [ true ]
18 validate_bool("false")
20 validate_bool($some_array)
25 raise Puppet::ParseError, "validate_bool(): wrong number of arguments (#{args.length}; must be > 0)"
29 unless function_is_bool([arg])
30 raise Puppet::ParseError, "#{arg.inspect} is not a boolean. It looks to be a #{arg.class}"