Problem


Your Puppet-based Completion Workflows fail with exit code 2, even though all expected actions were taken successfully. This causes the workflow step to fail and sometimes not proceed depending on the step configuration.


Solution


The exit codes used by Puppet do not follow the standard convention of anything other than 0 indicating a failure. Instead, an exit code 2 indicates that the node was successfully changed. See Puppet run exit status for more details.


You can update this behavior by adding the following code (or its equivalent) to your scripts or commands:


IF %errorlevel% EQU 2 exit /b 0


Otherwise, you can configure your workflow step to proceed on failure, however, this is less optimal because other non-0 exit codes are indicative of actual failures.