Torsten Lüttgert
2013-Aug-16 13:30 UTC
[Puppet Users] exit status of puppet agent --detailed-exitcodes
Hello group, is there a way to make puppet NOT return 2 if only exec{ } and notify{ } were called? Background is as follows: I''m calling puppet agent via cron on my hosts, and I want to get mails if something changes. For this, I used the exit code of "puppet agent --test --detailed-exitcodes", which should be 2 then (or 4/6 on error). Now, every stupid notify { } or exec{ } causes $? to be 2. Without notify I could live, but exec{ } (even with a failed precondition) also makes $?==2, and I need that. Is there any way around this? Thanks for any help, Torsten -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.
Torsten Lüttgert
2013-Aug-16 14:50 UTC
[Puppet Users] Re: exit status of puppet agent --detailed-exitcodes
Mh. It seems I spoke too hasty. exec{ }s which aren''t actually executed - e.g. via a successful unless: condition - don''t seem to cause $? to become 2. Notify does, though, and this doesn''t feel right. Anyway, the pressure is gone for me. Thanks anyway and regards, Torsten Am Freitag, 16. August 2013 15:30:48 UTC+2 schrieb Torsten Lüttgert:> > Hello group, > > is there a way to make puppet NOT return 2 if only exec{ } and notify{ } > were called? > > Background is as follows: > I''m calling puppet agent via cron on my hosts, and I want to get mails if > something changes. > For this, I used the exit code of "puppet agent > --test --detailed-exitcodes", which should be 2 then (or 4/6 on error). > > Now, every stupid notify { } or exec{ } causes $? to be 2. Without notify > I could live, but > exec{ } (even with a failed precondition) also makes $?==2, and I need > that. > > Is there any way around this? > > Thanks for any help, > Torsten > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.
jcbollinger
2013-Aug-17 16:45 UTC
[Puppet Users] Re: exit status of puppet agent --detailed-exitcodes
On Friday, August 16, 2013 9:50:37 AM UTC-5, Torsten Lüttgert wrote:> > Mh. It seems I spoke too hasty. exec{ }s which aren''t actually executed - > e.g. via a successful unless: condition - don''t seem > to cause $? to become 2. >That''s what I would expect, and it seems sensible to me.> Notify does, though, and this doesn''t feel right. Anyway, the pressure is > gone for me. > >That behavior is what I would have guessed, though I agree that it could be surprising. If you find it too troublesome then you could consider filing a feature request to change it, but I suspect that such a change would be rejected for fear of disrupting uses that depend on the current behavior. Though perhaps a parameter could be added to Notify to modulate that aspect of its behavior? John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.