Issue #19033 has been updated by Michael Armida.
The scenario is this: because of some information gathered at runtime, I run `puppet agent` from ssh via Fabric, as part of a scripted deployment process. Fabric makes the assumption that any nonzero exit status must indicate an error, so running puppet with `--detailed-exitcodes` requires a little ugliness to integrate properly, both in code to ignore the status 2, and in output, because Fabric always announces it as a failure (even if it ignores it), e.g.: <pre> marmida@monolith:~/develop/puppet-exitcodes$ venv/bin/fab -a -H localhost -i ~/.ssh/id_rsa.pub run_puppet [localhost] Executing task 'run_puppet' [localhost] run: puppet apply --detailed-exitcodes /home/marmida/develop/puppet-exitcodes/fail_manifest.pp [localhost] Passphrase for private key: [localhost] out: warning: Could not retrieve fact fqdn [localhost] out: err: /Stage[main]//Exec[false]/returns: change from notrun to 0 failed: /bin/false returned 1 instead of one of [0] at /home/marmida/develop/puppet-exitcodes/fail_manifest.pp:3 [localhost] out: notice: Finished catalog run in 0.09 seconds [localhost] out: Warning: run() received nonzero return code 4 while executing 'puppet apply --detailed-exitcodes /home/marmida/develop/puppet-exitcodes/fail_manifest.pp'! </pre> To be fair, `--detailed-exitcodes` isn't insufficient. In my head, however, I didn't expect that running without `--detailed-exitcodes` would only raise errors in the error cases you described above. In my case, restricting the definition of "failure" to the narrow case of "failing to apply the catalog" is less useful than the broader idea of "failing to bring all resources into sync," or even, "something went less than perfect." Certainly, part of this is the fault of Fabric for not providing more control over exit code interpretation, but I think it's making a sensible assumption. ---------------------------------------- Bug #19033: Exit status is 0, even in the presence of errors, without --detailed-exitcodes https://projects.puppetlabs.com/issues/19033#change-82818 Author: Michael Armida Status: Needs More Information Priority: Normal Assignee: Category: error reporting Target version: Affected Puppet version: 2.7.18 Keywords: Branch: When an error is encountered while running either `puppet apply` or `puppet agent`, the program exits with status 0. If `--detailed-exitcodes` is used with `puppet agent`, the status is nonzero as expected. I would expect that "non-detailed exit codes" would still include 1 for the case of a failure to apply the catalog. You can recreate this with the following manifest: <pre> exec { 'false': command => '/bin/false', } </pre> Example run: <pre> marmida@monolith:~$ puppet apply fail_manifest.py warning: Could not retrieve fact fqdn err: /Stage[main]//Exec[false]/returns: change from notrun to 0 failed: /bin/false returned 1 instead of one of [0] at /home/marmida/fail_manifest.py:3 notice: Finished catalog run in 0.14 seconds marmida@monolith:~$ echo $? 0 marmida@monolith:~$ puppet apply fail_manifest.py --detailed-exitcodes warning: Could not retrieve fact fqdn err: /Stage[main]//Exec[false]/returns: change from notrun to 0 failed: /bin/false returned 1 instead of one of [0] at /home/marmida/fail_manifest.py:3 notice: Finished catalog run in 0.13 seconds marmida@monolith:~$ echo $? 4 </pre> The same problems occur in `puppet agent`. I couldn't find another issue specific to the exit status, but I did notice it mentioned once here: http://projects.puppetlabs.com/issues/14458#note-6 -- 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 unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/puppet-bugs?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
