Hi, I have an exec {} that runs a command line script, for which 0 and 1 are both good return codes. (Specifically, spamassassin update; 1 means no new downloads). I tried returns => [0,1], but it still reports an error on RC = 1. Are multiple values not appropriate here? My workaround is to exec a wrapper script that traps ''1'' and returns 0. TIA -- John Ingersoll, Jr. Usage: fortune -P [] -a [xsz] [Q: [file]] [rKe9] -v6[+] dataspec ... inputdir --~--~---------~--~----~------------~-------~--~----~ 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 Thu, Sep 17, 2009 at 6:26 AM, John Ingersoll <jh.ingersoll@gmail.com>wrote:> Hi, > > I have an exec {} that runs a command line script, for which 0 and 1 are > both good return codes. (Specifically, spamassassin update; 1 means no new > downloads). I tried > > returns => [0,1], > > but it still reports an error on RC = 1. Are multiple values not > appropriate here? > > My workaround is to exec a wrapper script that traps ''1'' and returns 0. >Is this on 0.25.0? 0.24.8 doesn''t support multiple return codes, although it would be a trivial patch to backport. Another workaround is to or with true that we''ve done sometimes command => "/usr/bin/foo || true", but that''s more of a sledgehammer than specifying acceptable return codes.> > TIA > > -- > John Ingersoll, Jr. > Usage: fortune -P [] -a [xsz] [Q: [file]] [rKe9] -v6[+] dataspec ... > inputdir > > > >-- Nigel Kersten nigelk@google.com System Administrator Google Inc. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
John Ingersoll
2009-Sep-17 16:24 UTC
[Puppet Users] Re: Array of values for (exec) return?
On Thu, Sep 17, 2009 at 10:39 AM, Nigel Kersten <nigelk@google.com> wrote:> > > On Thu, Sep 17, 2009 at 6:26 AM, John Ingersoll <jh.ingersoll@gmail.com>wrote: > >> Hi, >> >> I have an exec {} that runs a command line script, for which 0 and 1 are >> both good return codes. (Specifically, spamassassin update; 1 means no new >> downloads). I tried >> >> returns => [0,1], >> >> but it still reports an error on RC = 1. Are multiple values not >> appropriate here? >> >> My workaround is to exec a wrapper script that traps ''1'' and returns 0. >> > > > Is this on 0.25.0? >no, we''re still on 0.24.8> > 0.24.8 doesn''t support multiple return codes, although it would be a > trivial patch to backport. >Thanks, guess I''m ok for now, though.> Another workaround is to or with true that we''ve done sometimes > > command => "/usr/bin/foo || true", > > but that''s more of a sledgehammer than specifying acceptable return codes. >Yes, actually I _want_ notification for RC > 1 Thank you -- John Ingersoll, Jr. Linux Sysadmin University of Georgia, Athens --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
John Ingersoll wrote:> Hi, > > I have an exec {} that runs a command line script, for which 0 and 1 are > both good return codes. (Specifically, spamassassin update; 1 means no > new downloads). I tried > > returns => [0,1],I''m using this for sa-update, in an exec:> /usr/bin/sa-update ; case $? in 0) /etc/init.d/spamassassin restart;; 1) : ;; *) echo Unknown Error; exit 1;; esacRegards, DavidS --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
John Ingersoll
2009-Sep-18 20:57 UTC
[Puppet Users] Re: Array of values for (exec) return?
On Fri, Sep 18, 2009 at 4:46 AM, David Schmitt <david@dasz.at> wrote:> > John Ingersoll wrote: > > Hi, > > > > I have an exec {} that runs a command line script, for which 0 and 1 are > > both good return codes. (Specifically, spamassassin update; 1 means no > > new downloads). I tried > > > > returns => [0,1], > > I''m using this for sa-update, in an exec: > > > /usr/bin/sa-update ; case $? in 0) /etc/init.d/spamassassin restart;; 1) > : ;; *) echo Unknown Error; exit 1;; esac >Very good; I had overlooked the simple bash syntax that can handle that . And I had forgotten about doing the restart when updates happen. Fortunately it''s a test box with not much happening yet. Thanks, -- John Ingersoll, Jr. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---