Puppet Tips&Tricks: debugging includes and inheritance

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: , , , , ,

Leave a Reply

Kumina helps companies innovate with the power of open source software. As specialists in managed IT operations since 2007, our mission is simple: building and managing the perfectly tailored technical infrastructures that allow our clients to thrive.

With fully managed solutions, we help our customers unlock the full potential of the cloud and Kubernetes. Our team also supports organisations with IT consulting and Kubernetes training courses. Learn more about our services or get in touch, we would love to hear about your business and projects.