Issue #7127 has been updated by Josh Cooper.

Status changed from Accepted to Merged - Pending Release
Assignee set to Josh Cooper

After much discussion, it was decided that the desired behavior was:

if prerun fails, don't apply catalog, include errors in the report, don't alter 
the report status, send the report, and exit(1)
if postrun fails, include errors in the report, don't alter the report status, 
send the report, and exit(1)

Part of the reasoning for this behavior is that in the use case where the 
prerun command checks to see if the master is under too much load, and aborts 
puppet if it is, it is always desirable to send the report, since it can be 
running on a different server than the puppet master.

Along the way I fixed several issues:

1. If the prerun command fails, we no longer apply the catalog, but we do run 
the postrun command, if present, and send the report (as it did before).
2. If the postrun command files, puppet would not send the report. This is now 
fixed (it will always send the report)
3. Errors during the prepare step, which includes plugin/fact download and 
prerun commands were not appended to the report. Now the report log destination 
is registered as early as possible, and unregistered as late as possible to 
ensure Configurer errors that occur in the run method are included in the 
report.
4. The transaction was closing the Configurer's report destination out from 
underneath it. As a result, postrun errors were not included in the report.

See commmit:f8c11329f1e0e0fb5648e26c7a5c58fc2341319e to 2.6.x
----------------------------------------
Bug #7127: prerun_command don't stop puppet on error 
https://projects.puppetlabs.com/issues/7127

Author: Victor Mora
Status: Merged - Pending Release
Priority: Urgent
Assignee: Josh Cooper
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