I do more and more Puppet, and I really like it. It’s a simple way to declare the desired state of the world. As I do more and more with Puppet, I needed to debug my manifests: check that they were doing the expected thing. I was looking for some kind of dry run option, similar to apt-get‘s or other tools, but puppet help apply didn’t provide any helpful hints. Until I stumbled upon Puppet dry run.

A direct run with --noop --test failed because --test was not recognized, but --noop was!. A sample run with --noop looks like this:

1 # puppet apply puppet/hosts/db03.staging.internal.pp  --noop
2 notice: /Stage[main]//Postgresql::Database[svreporting_staging]/Exec[createdb svreporting_staging]/returns: current_value notrun, should be 0 (noop)
3 notice: Postgresql::Database[svreporting_staging]: Would have triggered 'refresh' from 1 events
4 notice: /Stage[main]//Cron[replace svreporting_staging with svanalytics_staging]/ensure: current_value absent, should be present (noop)
5 notice: Class[Main]: Would have triggered 'refresh' from 2 events
6 notice: Stage[main]: Would have triggered 'refresh' from 1 events
7 notice: Finished catalog run in 10.86 seconds

Check the wording: Would have triggered, and should be. These are great ways to know what Puppet will do for you. There is only one caveat: when you need to spend more than a few minutes debugging your recipes, disable the automatic run. The scheduled run from puppet agent may go behind your back and apply your recipe, which you’re just debugging. In my case, this is very easy to do since I host my puppet manifests in a Git repository, which is pulled hourly and applied.

I’m only waiting for my pull request to be applied so you don’t have to go through the same process as I did.

Search

Your Host

A picture of me

I am François Beausoleil, a Ruby on Rails and Scala developer. During the day, I work on Seevibes, a platform to measure social interactions related to TV shows. At night, I am interested many things. Read my biography.

Top Tags

Books I read and recommend

Links

Projects I work on

Projects I worked on