Issue #7127 has been updated by Nigel Kersten.

Target version changed from 2.7.0 to 2.6.x

This will actually be targeted at 2.6.x and 2.7.x.

Rudy, I have a very minimal patch with no tests yet that appears to resolve the 
issue with prerun at least.

<pre>

--- a/lib/puppet/configurer.rb
+++ b/lib/puppet/configurer.rb
@@ -122,18 +122,20 @@ class Puppet::Configurer
   # which accepts :tags and :ignoreschedules.
   def run(options = {})
     begin
+      options[:report] ||= Puppet::Transaction::Report.new("apply")
+      report = options[:report]
+      Puppet::Util::Log.newdestination(report)
       prepare(options)
     rescue SystemExit,NoMemoryError
       raise
+    rescue CommandHookError => detail
+      Puppet.err detail
+      return
     rescue Exception => detail
       puts detail.backtrace if Puppet[:trace]
       Puppet.err "Failed to prepare catalog: #{detail}"
     end
 
-    options[:report] ||= Puppet::Transaction::Report.new("apply")
-    report = options[:report]
-    Puppet::Util::Log.newdestination(report)
-
     if catalog = options[:catalog]
       options.delete(:catalog)
     elsif ! catalog = retrieve_catalog
</pre>


----------------------------------------
Bug #7127: prerun_command don't stop puppet on error 
https://projects.puppetlabs.com/issues/7127

Author: Victor Mora
Status: Accepted
Priority: Urgent
Assignee: 
Category: plumbing
Target version: 2.6.x
Affected Puppet version: 
Keywords: 
Branch: 


When an error occurs in prerun_command, puppet continues execution instead of 
stopping.

We can see the error at the log file, but puppet continues 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 

We've tried with /bin/false as prerun_command 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 



-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to