This is the second post in a series of mine, describing some of the methods I use while developing our new Puppet modules. Read the first post in the series here: Variable variables.
Even though there are lots of interesting tools these days for debugging running code and even scripted code, I still seem to grab at the old method of printing random stuff in between my code. Especially when debugging my puppet modules. Some stuff to keep in mind when you also do this:
- All functions (like err, debug or warning) are server side only. This means you’ll have to search the log on your puppetmaster if you want to see the output from those.
- If you want to have output on your client, which is usually more convenient for me, use the notify resource. Use it like so:
notify { "Yes, we really arrived at this class.":; }
Which will output on the client something like this:
notice: //nagios::client/Notify[Yes, we really arrived at this class.]/message: defined 'message' as 'Yes, we really arrived at this class.'
Which at least shows you that a certain class is loaded. - Keep in mind that you can also include variables in the string you add! Very helpful to see if you get what you were expecting. I use that a lot to see if inline_templates give the output I expect.
Hope this helped someone!
Tags: debug, notify, puppet, puppet-tips-and-tricks, tips, tricks