Chef-Client Exit Codes

Signal outside tools of specific Chef-Client run status. Ability to determine results of a Chef-Client run.

Motivation

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.

Specification

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 idential 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 : * ~~35,37,40,41,42~~,43,44,45,46,47,48,49,79,81,90,91,92,93,94,95,96,97 * 98,99,115,116,168,169,172,175,176,177,178,179,181,184,185,204,211 * ~~213~~,219,227,228,235,236,237,238,239,241,242,243,244,245

Precedence

Exit Codes in Use

Reboot Requirement

Exit Code | Reason | Details ------------- | ------------- |----- 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

Exit Code | Reason | Details ------------- | ------------- |----- -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

Extend

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

Copyright

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.