On Tue, Aug 3, 2010 at 7:38 PM, Jon Wilson <[email protected]> wrote: > OK, some success. I get some unformatted output, PSON I think. I'm > pretty sure it just takes the node definition as input (cached if > available) and merely compiles my classes. I don't think facts get > involved, because that's part of the instantiation phase (see > http://projects.puppetlabs.com/projects/1/wiki/Puppet_Internals).
Facts are required to compile the manifests into a catalog. > > That will be sufficient for unit tests that catch compile-time > manifest errors. I'll have to work a little harder to get more usable > output (Yaml?), or to write any tests that use facts (real, cached or > faked). > > On Aug 3, 9:20 pm, Jon Wilson <[email protected]> wrote: >> Thanks Patrick, I'll give that a try. >> >> I'm not too worried about breaking existing configuration, or cached >> facts. Everything will be running in a sandbox, which will be clean >> prior to every test run. >> >> On Aug 3, 12:22 pm, Patrick Mohr <[email protected]> wrote: >> >> > On Aug 2, 2010, at 5:50 PM, Jon Wilson wrote: >> >> > > Hiya, >> >> > > Is there a way I can easily generate the catalog for a particular >> > > puppet client, without actually running Puppet on that client? >> >> > > I'd like to write some unit tests for my Puppet master, which generate >> > > catalogs for a set of clients, and check their content. This will >> > > syntax & sanity check my manifests, without getting stuck in >> > > certificate hell. >> >> > Here's a command to get you started: >> > puppetmasterd --compile clients.fqdn >> >> > I'm not sure how, but some magic is being done to get the client's facts. >> > I'm assuming the facts are cached from an earlier run, but this is pure >> > speculation. >> >> > If you run it with --verbose, it will send that information to stderr. >> >> > To make the tests much shorter on failure, you probably want to test the >> > erb using "erb -x -P -T '-' $1 | ruby -c " and test the config using >> > --parseonly. >> >> > Warning: when the catalog is compiled, everything* that would normally be >> > done with storeconfigs will be done. This means running tests like this >> > can affect your existing configuration. >> >> > *I'm not actually sure it does everything, but it does most of the >> > storeconfigs stuff. > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > > -- nigel -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
