Skip to content

Instantly share code, notes, and snippets.

@jpadams
Created August 4, 2013 22:36
Show Gist options
  • Save jpadams/6152236 to your computer and use it in GitHub Desktop.
Save jpadams/6152236 to your computer and use it in GitHub Desktop.
$tests = [
undef, # this is NOT a hash
'foobar', # this string is NOT a hash
### these are all the same as far as puppet is concerned
#{a => b}, #
#{"a" => "b"}, #
{'a' => 'b'}, #
################
#{:a => :b}, this is not parseable
"{:a => :b}",# this is NOT a hash
{1 => 2}, # this IS a hash!
"{3 => 4}" # this IS NOT a hash!! a string.
]
hash_test { $tests: }
define hash_test ($test = $title) {
if is_hash($test) {
notify{"yes, ${test} is a hash.\n":}
} else {
notify {"no, ${test} is NOT a hash.\n":}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment