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