4 module Puppet::Parser::Functions
5 newfunction(:validate_hash, :doc => <<-DOC
7 Validate that all passed values are hash data structures. Abort catalog
8 compilation if any value fails this check.
15 The following values will pass:
17 $my_hash = { 'one' => 'two' }
18 validate_hash($my_hash)
20 The following values will fail, causing compilation to abort:
23 validate_hash('some_string')
25 validate_hash($undefined)
29 function_deprecation([:validate_hash, 'This method is deprecated, please use the stdlib validate_legacy function,
30 with Stdlib::Compat::Hash. There is further documentation for validate_legacy function in the README.'])
33 raise Puppet::ParseError, "validate_hash(): wrong number of arguments (#{args.length}; must be > 0)"
37 unless arg.is_a?(Hash)
38 raise Puppet::ParseError, "#{arg.inspect} is not a Hash. It looks to be a #{arg.class}"