After experiementing a bit with puppet I found a very interesting phenomenon: Sometimes a host fails to load a class with this error:

 err: Could not retrieve catalog: Could not find class common::nico_ethz at /etc/puppet/manifests/nodes/nico.pp:35 on node bach21.ethz.ch

The strange thing is that it does work sometimes. After describing the situation in the IRC channel #puppet, I got an "interesting" explanation for that behaviour:

First of all I did a mistake, because I placed the class common::nico_ethz into the file modules/common/manifests/nico.pp instead of modules/common/manifests/nico_ethz.pp.

But why does it work sometimes? It works sometimes, because the puppetmaster compiles the catalog for all nodes and reuses the compiled catalog for different hosts. If a previous node loaded the class common::nico, the complete content of modules/common/manifests/nico.pp is in the catalog, including common::nico_ethz. This is the reason why it sometimes works and that's also the reason why I am writing this posting:

  • Dear other puppet users: Be aware that sometimes a class may be included indirectly and thus things work randomly (like Schrödinger's cat)!
  • Dear puppet developers: It would be way more helpful, if a wrong configuration always and not only sometimes fails!

If you've a comment to this blog article, please redirect it to the puppet users mailinglist, to which I sent a notice about this article.

Update #1

I switched over to use cdist instead of Puppet.