puppetlabs/puppetlabs-stdlib — pull request #330 by logicminds (2014-09-26 17:48:37+00:00)
Title: Added dump_args statement function for debugging puppet code

This adds a new function that outputs the variables to STDOUT. Its pretty dead simple and when used with an rspec test it can decrease debug time greatly. The only other option is to use a bunch of notify resources which to me is not as fast and does not display the variables correctly when you have hashes and arrays in your variables. If you think this is not useful imagine storing a large hash in hiera and wanting to know why your custom parser is blowing up on your data and the notify statement does a poor job of displaying your 50 line data hash. Its really nice to see whats in your puppet variables and this helps immensely.

Another use case is trying to find out why create_resources isn't working as expected because your data being passed in is all wrong.

Basically it works like this:

puppet code below:
```puppet
$var1 = 'foo'
$var2 = ['bar']
$var3 = {'foo' => 'bar'}
dump_args($var1, $var2, $var3)

```
yields the following in STDOUT

```json
[
"foo",
[
"bar"
],
{
"foo": "bar"
}
]
```