Douglas Garstang
2011-Mar-01 23:43 UTC
[Puppet Users] External node script flagging errors.
What is the best way to have an external node script that encounters an error fail? What should it do? Should it return a non zero exit code to the OS? (of course, this doesn''t seem to be documented anywhere). I just tested the situation where my exteral node script returned 1 to the OS and printed error on the screen, and when that node runs puppet, it seems to run just fine. Maybe it''s caching something. However, it would be nice to have the client error out in such a way that I know there was a problem with the external node script loading it''s info. Anyone? Doug -- 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 Mar 1, 11:43 pm, Douglas Garstang <doug.garst...@gmail.com> wrote:> What is the best way to have an external node script that encounters an > error fail? What should it do? Should it return a non zero exit code to the > OS? (of course, this doesn''t seem to be documented anywhere).http://docs.puppetlabs.com/guides/external_nodes.html says: "if you want a node to not be recognized, and to be treated as though it was not included in the configuration, your script should exit with a non-zero exit code" cheers Jon -- 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.
Alan Barrett
2011-Mar-02 18:32 UTC
Re: [Puppet Users] External node script flagging errors.
On Tue, 01 Mar 2011, Douglas Garstang wrote:> What is the best way to have an external node script that > encounters an error fail? What should it do? Should it return a > non zero exit code to the OS?Yes. I am almost sure that works. If not, it''s a bug.> Maybe it''s caching something.I think the external node classifier is not re-run if the facts have not changed. There''s a feature request to make it run every time.> However, it would be nice to have the client error out in such > a way that I know there was a problem with the external node > script loading it''s info. Anyone?Something else I have done, and that might suit you, is let the node classifier script return an almost-empty non-error result, like this: --- parameters: error_message: "Something is wrong" classes: [] Then the top-level site.pp can do something like this: if $error_message { fail("External node classifier says: $error_message") } --apb (Alan Barrett) -- 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.