Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to pretty-print hashes and arrays for puppet debugging
ubuntu@ubuntu:~$ puppet apply pretty.pp [12/46]
Notice: Scope(Class[main]): {one => 1, two => [dos, 2]}
Notice: Scope(Class[main]):
{
"one": "1",
"two": [
"dos",
"2"
]
}
Notice: Compiled catalog for dawiest-vpcsc1afm in environment production in 0.12 seconds
Notice: Applied catalog in 0.02 seconds
#Example puppet code with an inline template to pretty-print a hash
$hash = { 'one' => '1',
'two' => [ 'dos', '2' ],
}
$content = inline_template("
<%- require 'json' -%>
<%= JSON.pretty_generate(@hash) %>
")
notice($hash)
notice($content)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment