Puppet: System Administration Automated

Example code: Testing relationships to base classes


I think I promised a while ago to start posting the example code I use for tests.

Here's the code I used to reproduce #1030:

class base {
    notify { "This is the base class": }
}

class sub inherits base {
    notify { "This is the sub class": }
}

include sub

notify { "This is the main class": require => Class[base] }

Sure enough, I get this exception:

luke@phage(0) $ test.pp
Could not find dependency Class[base] for Notify[This is the main class] at /Users/luke/bin/test.pp:41
luke@phage(1) $

Turns out the problem is in lib/puppet/parser/compile.rb; or rather, the problem is that the code is in this file, instead of in lib/puppet/parser/ast/hostclass.rb. The Compile class creates a resource for every class it evaluates, which is how these relationships work, but it's that AST class that actually knows when base classes are evaluated by a subclass, so it needs to be creating these resources.

add to del.icio.us Add to Blinkslist add to furl Digg it add to ma.gnolia Stumble It! add to simpy seed the vine TailRank post to facebook

Thu, 07 Feb 2008 | Tags: , ,


Jeff McCune posts his WWDC examples


Jeff McCune has posted his example code from WWDC. He gave a short (and apparently very well received) presentation on Puppet there, and he's now not only posted the example code but he promises more in the near future.

add to del.icio.us Add to Blinkslist add to furl Digg it add to ma.gnolia Stumble It! add to simpy seed the vine TailRank post to facebook

Wed, 27 Jun 2007 | Tags: , , ,