# validate_bool.rb
#
module Puppet::Parser::Functions
- newfunction(:validate_bool, :doc => <<-'DOC') do |args|
- Validate that all passed values are either true or false. Abort catalog
- compilation if any value fails this check.
+ newfunction(:validate_bool, :doc => <<-DOC
+ @summary
+ Validate that all passed values are either true or false. Abort catalog
+ compilation if any value fails this check.
- The following values will pass:
+ @return
+ validate boolean
- $iamtrue = true
- validate_bool(true)
- validate_bool(true, true, false, $iamtrue)
+ @example **Usage**
- The following values will fail, causing compilation to abort:
+ The following values will pass:
- $some_array = [ true ]
- validate_bool("false")
- validate_bool("true")
- validate_bool($some_array)
+ $iamtrue = true
+ validate_bool(true)
+ validate_bool(true, true, false, $iamtrue)
- DOC
+ The following values will fail, causing compilation to abort:
+ $some_array = [ true ]
+ validate_bool("false")
+ validate_bool("true")
+ validate_bool($some_array)
+ DOC
+ ) do |args|
if args.empty?
raise Puppet::ParseError, "validate_bool(): wrong number of arguments (#{args.length}; must be > 0)"
end