When the salt or salt-call CLI commands result in an error, the command
will exit with a return code of 1. Error cases consist of the following:
False resultresult
or success, which has a value of FalseIn addition to the cases listed above, if a state or remote-execution function
sets a nonzero value in the retcode key of the __context__ dictionary, the command will exit with a return code of
1. For those developing custom states and execution modules, using
__context__['retcode'] can be a useful way of signaling that an error has
occurred:
if something_went_wrong:
__context__['retcode'] = 42
This is actually how states signal that they have failed. Different cases result in different codes being set in the __context__ dictionary:
False resultWhen the --retcode-passthrough flag is used with salt-call, then
salt-call will exit with whichever retcode was set in the __context__ dictionary, rather than the default behavior which simply
exits with 1 for any error condition.