xin zhang
2013-Jan-24 06:24 UTC
[Puppet Users] puppet agent returns zero even when fails to execute a catalog
I am running below command to connect puppet master puppet agent --certname testcertname --no-daemonize --onetime --server server_host_name --verbose it outputs error like: Error: Execution of ''/usr/bin/yum -d 0 -e 0 -y install dnsmasq'' returned 1: Error: Cannot find a valid baseurl for repo: base Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was 14: PYCURL ERROR 6 - "Couldn''t resolve host ''mirrorlist.centos.org''" Error: /Stage[main]/Virtualrouter_agent/Package[dnsmasq]/ensure: change from absent to present failed: Execution of ''/usr/bin/yum -d 0 -e 0 -y install dnsmasq'' returned 1: Error: Cannot find a valid baseurl for repo: base Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was 14: PYCURL ERROR 6 - "Couldn''t resolve host ''mirrorlist.centos.org''" to my surprise, echo $? returns 0 which indicates a success. why doesn''t puppet return 1? my script heavily depends on the return value to judge if puppet runs successfully. Is there any dependable way to get the real execution result of puppet agent? thank you. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/-GIkg6P3_04J. 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.
Matthaus Owens
2013-Jan-24 06:34 UTC
Re: [Puppet Users] puppet agent returns zero even when fails to execute a catalog
You can pass the --detailed-exitcodes flag to puppet agent to get non-zero exit codes. Here''s the description from the puppet-agent man page: --detailed-exitcodes Provide transaction information via exit codes. If this is enabled, an exit code of ''2'' means there were changes, an exit code of ''4'' means there were failures during the transaction, and an exit code of ''6'' means there were both changes and failures. HTH On Wed, Jan 23, 2013 at 10:24 PM, xin zhang <xing5820@gmail.com> wrote:> I am running below command to connect puppet master > > puppet agent --certname testcertname --no-daemonize --onetime --server > server_host_name --verbose > > it outputs error like: > > Error: Execution of ''/usr/bin/yum -d 0 -e 0 -y install dnsmasq'' returned 1: > Error: Cannot find a valid baseurl for repo: base > Could not retrieve mirrorlist > http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was > 14: PYCURL ERROR 6 - "Couldn''t resolve host ''mirrorlist.centos.org''" > > Error: /Stage[main]/Virtualrouter_agent/Package[dnsmasq]/ensure: change from > absent to present failed: Execution of ''/usr/bin/yum -d 0 -e 0 -y install > dnsmasq'' returned 1: Error: Cannot find a valid baseurl for repo: base > Could not retrieve mirrorlist > http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was > 14: PYCURL ERROR 6 - "Couldn''t resolve host ''mirrorlist.centos.org''" > > to my surprise, echo $? returns 0 which indicates a success. > > why doesn''t puppet return 1? my script heavily depends on the return value > to judge if puppet runs successfully. > Is there any dependable way to get the real execution result of puppet > agent? > > thank you. > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/puppet-users/-/-GIkg6P3_04J. > 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.-- Matthaus Owens Release Manager, Puppet Labs -- 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.