Victor Mora
2011-Mar-09 09:04 UTC
[Puppet Users] prerun_command don''t stop puppet on error
When an error occurs in prerun_command, puppet continues execution instead of stopping. We can see the error at the log file, but puppet cotinues doing changes: puppetd[18430]: Failed to prepare catalog: Could not run command from prerun_command: Execution of ''/path/to/command'' returned 1: We want to prevent changes when an error occurs in prerun_command. Our puppet.conf: [main] server = server.domain runinterval = 300 summarize = true listen = true client = false logdir = /var/log/puppet vardir = /var/lib/puppet ssldir = /var/lib/puppet/ssl rundir = /var/run/puppet prerun_command = /server/host/manage integrity check postrun_command = /server/host/manage integrity update -- 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.
Patrick
2011-Mar-09 21:11 UTC
Re: [Puppet Users] prerun_command don''t stop puppet on error
On Mar 9, 2011, at 1:04 AM, Victor Mora wrote:> When an error occurs in prerun_command, puppet continues execution > instead of stopping. > > We can see the error at the log file, but puppet cotinues doing > changes: > > puppetd[18430]: Failed to prepare catalog: Could not run command from > prerun_command: Execution of ''/path/to/command'' returned 1: > > We want to prevent changes when an error occurs in prerun_command. > > Our puppet.conf: > > [main] > server = server.domain > runinterval = 300 > summarize = true > > listen = true > client = false > > logdir = /var/log/puppet > vardir = /var/lib/puppet > ssldir = /var/lib/puppet/ssl > rundir = /var/run/puppet > > prerun_command = /server/host/manage integrity check > postrun_command = /server/host/manage integrity updateMy understanding was that the command failing would stop puppet from running. Would you please test with the command "/bin/false" or "/usr/bin/false"? (I''m assuming that you''re on a version of *nix which has one of these commands.) What version of puppet do you have? ("puppet --version") -- 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.
Victor Mora
2011-Mar-16 07:48 UTC
[Puppet Users] Re: prerun_command don''t stop puppet on error
I''ve tried with /bin/false with the same result. You can see and error at log file, but it continues with changes: Mar 16 08:44:27 sistemes puppetd[26894]: Failed to prepare catalog: Could not run command from prerun_command: Execution of ''/bin/false'' returned 1: Mar 16 08:44:43 sistemes puppetd[26894]: (//nagios-service/File[/etc/ nagios3]/checksum) checksum changed ''{mtime}Fri Mar 04 12:08:06 +0100 2011'' to ''{mtime}Wed Mar 16 08:41:07 +0100 2011'' Mar 16 08:44:58 sistemes puppetd[26894]: Finished catalog run in 17.95 seconds Our puppet version: puppet --version 0.25.4 On Mar 9, 10:11 pm, Patrick <kc7...@gmail.com> wrote:> On Mar 9, 2011, at 1:04 AM, Victor Mora wrote: > > > > > When an error occurs in prerun_command, puppet continues execution > > instead of stopping. > > > We can see the error at the log file, but puppet cotinues doing > > changes: > > > puppetd[18430]: Failed to prepare catalog: Could not run command from > > prerun_command: Execution of ''/path/to/command'' returned 1: > > > We want to prevent changes when an error occurs in prerun_command. > > > Our puppet.conf: > > > [main] > > server = server.domain > > runinterval = 300 > > summarize = true > > > listen = true > > client = false > > > logdir = /var/log/puppet > > vardir = /var/lib/puppet > > ssldir = /var/lib/puppet/ssl > > rundir = /var/run/puppet > > > prerun_command = /server/host/manage integrity check > > postrun_command = /server/host/manage integrity update > > My understanding was that the command failing would stop puppet from running. Would you please test with the command "/bin/false" or "/usr/bin/false"? (I''m assuming that you''re on a version of *nix which has one of these commands.) > > What version of puppet do you have? ("puppet --version")-- 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.
Nan Liu
2011-Mar-16 09:13 UTC
Re: [Puppet Users] Re: prerun_command don''t stop puppet on error
On Wed, Mar 16, 2011 at 3:48 PM, Victor Mora <j.victor.mora@gmail.com> wrote:> I''ve tried with /bin/false with the same result. You can see and error > at log file, but it continues with changes: > > Mar 16 08:44:27 sistemes puppetd[26894]: Failed to prepare catalog: > Could not run command from prerun_command: Execution of ''/bin/false'' > returned 1: > Mar 16 08:44:43 sistemes puppetd[26894]: (//nagios-service/File[/etc/ > nagios3]/checksum) checksum changed ''{mtime}Fri Mar 04 12:08:06 +0100 > 2011'' to ''{mtime}Wed Mar 16 08:41:07 +0100 2011'' > Mar 16 08:44:58 sistemes puppetd[26894]: Finished catalog run in 17.95 > seconds > > Our puppet version: > puppet --version > 0.25.4hmm, I can duplicate this in 2.6.4 as well: info: Retrieving plugin err: Failed to prepare catalog: Could not run command from prerun_command: Execution of ''/bin/false'' returned 1: info: Caching catalog for pe-master info: Applying configuration version ''Tue Mar 1 16:40:25 EST 2011'' notice: Finished catalog run in 0.05 seconds Looking at source, puppet should exit after the rescue instead of proceed along: 127 def run(options = {}) 128 begin 129 prepare 130 rescue SystemExit,NoMemoryError 131 raise 132 rescue Exception => detail 133 puts detail.backtrace if Puppet[:trace] 134 Puppet.err "Failed to prepare catalog: #{detail}" 135 exit(1) 136 end Adding exit(1) on 135 forces puppet to quit at this point, but I''m not sure if this is the appropriate fix. This seems to be a bug, and I''ll file a redmine ticket if there isn''t a duplicate. Thanks, Nan -- 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.
Douglas Garstang
2011-Mar-16 16:42 UTC
Re: [Puppet Users] Re: prerun_command don''t stop puppet on error
On Wed, Mar 16, 2011 at 2:13 AM, Nan Liu <nan@puppetlabs.com> wrote:> On Wed, Mar 16, 2011 at 3:48 PM, Victor Mora <j.victor.mora@gmail.com> > wrote: > > I''ve tried with /bin/false with the same result. You can see and error > > at log file, but it continues with changes: > > > > Mar 16 08:44:27 sistemes puppetd[26894]: Failed to prepare catalog: > > Could not run command from prerun_command: Execution of ''/bin/false'' > > returned 1: > > Mar 16 08:44:43 sistemes puppetd[26894]: (//nagios-service/File[/etc/ > > nagios3]/checksum) checksum changed ''{mtime}Fri Mar 04 12:08:06 +0100 > > 2011'' to ''{mtime}Wed Mar 16 08:41:07 +0100 2011'' > > Mar 16 08:44:58 sistemes puppetd[26894]: Finished catalog run in 17.95 > > seconds > > > > Our puppet version: > > puppet --version > > 0.25.4 > > hmm, I can duplicate this in 2.6.4 as well: > info: Retrieving plugin > err: Failed to prepare catalog: Could not run command from > prerun_command: Execution of ''/bin/false'' returned 1: > info: Caching catalog for pe-master > info: Applying configuration version ''Tue Mar 1 16:40:25 EST 2011'' > notice: Finished catalog run in 0.05 seconds > > Looking at source, puppet should exit after the rescue instead of proceed > along: > > 127 def run(options = {}) > 128 begin > 129 prepare > 130 rescue SystemExit,NoMemoryError > 131 raise > 132 rescue Exception => detail > 133 puts detail.backtrace if Puppet[:trace] > 134 Puppet.err "Failed to prepare catalog: #{detail}" > 135 exit(1) > 136 end > > Adding exit(1) on 135 forces puppet to quit at this point, but I''m not > sure if this is the appropriate fix. This seems to be a bug, and I''ll > file a redmine ticket if there isn''t a duplicate. > > Thanks, > >Is usecacheonfailure = false relevant here? 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.