Chef-Client Exit Codes
Nicholas Carpenter <firstname.lastname@example.org>
Chef-Client Exit Codes
Signal outside tools of specific Chef-Client run status. Ability to determine results of a Chef-Client run.
As a Chef user, I want to be able to determine when a chef-client run is rebooting the node, so that Test-Kitchen/Vagrant/any outside tool can wait for node to reboot, and continue converging.
- Chef applications (e.g. chef-client) that interpret recipes should use the specified exit codes
- Chef tools (e.g. knife) should behave appropriately for the exit code, or pass it to the user
Exit codes Reserved by Operating System
Remaining Available Exit Codes
All exit codes defined should be usable on all supported Chef Platforms. Also the exit codes used should be identical across platforms. That limits the total range from 1-255. Exit codes not explicitly used by Linux/Windows are listed below. There are 59 exit codes that are available on both platforms.
- Any numbers below that have a strike-through are used below in the Exit Codes in Use section
- Exit Codes Available for Chef use :
- Reboot exit codes should take precedence over Chef Execution State
- Precedence within a table should be evaluated from the top down.
- Example - Audit Mode Failure would only apply on a successful execution. But if the chef-run failed for any other reason, no reason to exit with audit mode.
Exit Codes in Use
|35||Reboot Scheduled||Reboot has been scheduled in the run state|
|37||Reboot Needed||Reboot needs to be completed|
|41||Reboot Failed||Initiated Reboot failed - due to permissions or any other reason|
Chef Run State
|-1||Failed execution*||Generic error during Chef execution. On Linux this will show up as 255, on Windows as -1|
|0||Successful run||Any successful execution of a Chef utility should return this exit code|
|1||Failed execution||Generic error during Chef execution.|
|2||SIGINT received||Received an interrupt signal|
|3||SIGTERM received||Received an terminate signal|
|42||Audit Mode Failure||Audit mode failed, but chef converged successfully.|
|213||Chef upgrade||Chef has exited during a client upgrade|
- *Next release should deprecate any use of this exit code.
This RFC should be able to be amended to include additional exit code functionality at a later date. Additional exit codes are assigned by pull request against this RFC as detailed in RFC000
This work is in the public domain. In jurisdictions that do not allow for this, this work is available under CC0. To the extent possible under law, the person who associated CC0 with this work has waived all copyright and related or neighboring rights to this work.