Rich Rauenzahn
2011-Feb-04 03:02 UTC
[Puppet Users] failing with fail() without failing everything
We would like to have a default node applied to systems, but also trigger a failure so that we notice the system in puppet-dashboard. At the moment we''re doing... node default { include system_defaults fail("$hostname doesn''t have a node to apply to it") } Unfortunately this seems to fail before the system_defaults class can be applied to the node (which we want applied every time). And err() doesn''t propagate up to the dashboard. Is there any way to accomplish what I want? Rich -- 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.
Nan Liu
2011-Feb-04 03:52 UTC
Re: [Puppet Users] failing with fail() without failing everything
On Thu, Feb 3, 2011 at 7:02 PM, Rich Rauenzahn <rrauenza@gmail.com> wrote:> We would like to have a default node applied to systems, but also > trigger a failure so that we notice the system in puppet-dashboard. > > At the moment we''re doing... > > node default { > include system_defaults > fail("$hostname doesn''t have a node to apply to it") > } > > Unfortunately this seems to fail before the system_defaults class can > be applied to the node (which we want applied every time). And err() > doesn''t propagate up to the dashboard.Fail function fails the catalog, and without a catalog the client does not have anything to apply. This is intended as a big red stop button. You can use bad exec to generate a message and still provide the resources in system_defaults class which flags this in dashboard (but I thought this gets applied to ENC nodes anyhow). exec { "/bin/echo ''not defined''; exit 1": } This feels like a kludge, and perhaps the following process is better. Write a function on the puppetmaster that appends a file on the master about undefined nodes. Create a notify resource that''s tagged=alertme, and use tagmail function to email an alert as necessary. Not sure if anyone else have a more elegant solution. Thanks, Nan -- 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.