First, apologies if this is a FAQ: a few weeks of searching and reading hasn''t uncovered anything particularly helpful. I''ll be happy to summarize the results in a blog post or some more official place. I''m having a hard time figuring out how best to develop and test changes to Puppet manifests. First, I don''t have any way to test a change aside from tossing it on the server and running puppetd --test --noop on a potentially-affected client. Fundamentally, this is testing puppet''s function mapping [ facts, manfiests, files ] => actions, and I would love to have a way to run that function without requiring a full, distributed puppetmasterd/puppetd setup, replete with correct facts on the client. Is there another way? Second, I''m working on refactoring our puppet configuration, and in so doing it would be best to ensure I haven''t unexpectedly changed any resources. Is there any machine-parsable way of seeing the set of resources that result from a particular manifest and set of facts? Thanks for any pointers! Dustin -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Tue, Dec 28, 2010 at 9:45 AM, Dustin J. Mitchell <dustin@mozilla.com> wrote:> First, apologies if this is a FAQ: a few weeks of searching and reading > hasn''t uncovered anything particularly helpful. I''ll be happy to > summarize the results in a blog post or some more official place. > > I''m having a hard time figuring out how best to develop and test changes > to Puppet manifests. > > First, I don''t have any way to test a change aside from tossing it on > the server and running puppetd --test --noop on a potentially-affected > client. Fundamentally, this is testing puppet''s function mapping [ > facts, manfiests, files ] => actions, and I would love to have a way to > run that function without requiring a full, distributed > puppetmasterd/puppetd setup, replete with correct facts on the client. > Is there another way?You can do an awful lot of testing locally with "puppet" (puppet apply if you''re on 2.6.x) rather than puppetd and a server. Something I''ve found particularly useful is to make use of the facter feature where environment variables prefixed with "FACTER_" get turned into facts. e.g. FACTER_foo="bar" puppet --verbose /tmp/test.pp will create "$foo" with a value of "bar". You can also make use of the "factpath" setting to supply multiple locations. I do this a fair bit when testing fact interactions. puppet --verbose --factpath="/var/lib/puppet/lib/facter:/tmp/testfacts" /tmp/test.pp As is often the case, RI has a good blog post up about this too: http://www.devco.net/archives/2009/08/19/tips_and_tricks_for_puppet_debugging.php> > Second, I''m working on refactoring our puppet configuration, and in so > doing it would be best to ensure I haven''t unexpectedly changed any > resources. Is there any machine-parsable way of seeing the set of > resources that result from a particular manifest and set of facts?When working with the server you can inspect the catalog. Again, RI has a tool he''s been working on, and I expect we''ll end up distributing something in the Puppet codebase to achieve the same goals. https://github.com/ripienaar/puppet-catalog-diff> > Thanks for any pointers! > > Dustin > > -- > You received this message because you are subscribed to the Google Groups "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Dec 28, 2010, at 9:45 AM, Dustin J. Mitchell wrote:> Second, I''m working on refactoring our puppet configuration, and in so > doing it would be best to ensure I haven''t unexpectedly changed any > resources. Is there any machine-parsable way of seeing the set of > resources that result from a particular manifest and set of facts? > > Thanks for any pointers!Take a look at the --compile option on puppetmasterd. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On 12/28/2010 09:04 PM, Patrick wrote:> > On Dec 28, 2010, at 9:45 AM, Dustin J. Mitchell wrote: > >> Second, I''m working on refactoring our puppet configuration, and in so >> doing it would be best to ensure I haven''t unexpectedly changed any >> resources. Is there any machine-parsable way of seeing the set of >> resources that result from a particular manifest and set of facts? >> >> Thanks for any pointers! > > Take a look at the --compile option on puppetmasterd. >For refactoring, http://projects.puppetlabs.com/projects/1/wiki/Using_Multiple_Environments can be of interest. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
* Dustin J. Mitchell [2010-12-28]:> I''m having a hard time figuring out how best to develop and test > changes to Puppet manifests.Depending on the meaning of "test changes to Puppet manifests", cucumber-puppet might be of interest. It allows you to specify test cases and verifies catalog behaviour against them. The project is hosted at http://projects.puppetlabs.com/projects/cucumber-puppet. cheers, Nikolay -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.