I am writing a bash script which will run puppet as follows: puppetd --test --env test I need my script to be able to tell if puppet ran successfully, I thought I might be able to do this by checking the exit code ($?) but it seems that regardless of whether the puppet run succeeds or fails it always gives and exit code of 0. for example: err: Could not retrieve catalog from remote server: Error 400 on SERVER: Failed to contact Foreman execution expired at /var/puppet...script.pp on node servername.com warning: Not using cache on failed catalog err: Could not retrieve catalog; skipping run [user@servername]# echo $? 0 I read on the puppet documentation web pages that there is a parameter called --detailed-exitcodes which I thought might help but that doesn''t work at all: puppetd --test --detailed-exitcodes --env test invalid option: --detailed-exitcodes Try ''/usr/sbin/puppetd --help'' Am I missing something here, is there any other way for me to tell if puppet failed? Thanks Martin -- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
On Mar 20, 2013, at 8:00 AM, MartinW <mwyett@gmail.com> wrote:> I read on the puppet documentation web pages that there is a parameter called --detailed-exitcodes which I thought might help but that doesn''t work at all: > > puppetd --test --detailed-exitcodes --env test > invalid option: --detailed-exitcodes > Try ''/usr/sbin/puppetd --help'' > > Am I missing something here, is there any other way for me to tell if puppet failed?Isn''t puppetd deprecated in favor of "puppet agent"? I use --detailed-exitcodes with "puppet apply" and Puppet 3 and it works like it says on the box. -- Brian Lalor blalor@bravo5.org -- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Hi, good find. As far as I''ve learned, --test implies the "funny exit codes" option, so you likely want to try "puppet agent --one-time --nodaemonize". HTH, Felix On 03/20/2013 03:00 PM, MartinW wrote:> I read on the puppet documentation web pages that there is a parameter > called --detailed-exitcodes which I thought might help but that doesn''t > work at all: > > puppetd --test --detailed-exitcodes --env test > invalid option: --detailed-exitcodes > Try ''/usr/sbin/puppetd --help'' > > Am I missing something here, is there any other way for me to tell if > puppet failed? > > Thanks > Martin-- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Thanks for the replies. I may have found why --test isn''t giving the expected response. puppetd --version 0.25.5 :o - I have no choice but to continue using it as well. Will it be impossible for me to get this working with such an old version? -- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
On 03/20/2013 03:26 PM, MartinW wrote:> Thanks for the replies. I may have found why --test isn''t giving the > expected response. > > puppetd --version > 0.25.5Yea, shame on you.> :o - I have no choice but to continue using it as well. Will it be > impossible for me to get this working with such an old version?The --onetime will do anyway, just replace "puppet agent" with "puppetd". -- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
On Wednesday, March 20, 2013 7:16:17 AM UTC-7, blalor wrote:> > > > Isn''t puppetd deprecated in favor of "puppet agent"? I > use --detailed-exitcodes with "puppet apply" and Puppet 3 and it works like > it says on the box. > >huh. never realized there was such a flag. Thanks for that. but really, "[return an appropriate exitcode]" should be standard, dont you think? Particularly in the case of calling puppet agent /file/does/not/exist and it still returns 0 ? !! Is there a way to force sane exitcode behaviour by default, in puppet.conf? -- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.