Ask Your Question

Revision history [back]

The exec resource type supports a "returns" parameter which specifies the return codes that will be treated as successful. For example, /bin/false returns 1 so puppet flags an error here:

$ puppet apply -e ' exec { "/bin/false": } '
err: /Stage[main]//Exec[/bin/false]/returns: change from notrun to 0 failed: /bin/false returned 1 instead of one of [0] at line 1
notice: Finished catalog run in 0.09 seconds

We can allow the exec to succeed by providing a "returns" parameter which states that a return code of 1 is OK. This parameter can be an array:

$ puppet apply -e ' exec { "/bin/false": returns => [0,1] } '
notice: /Stage[main]//Exec[/bin/false]/returns: executed successfully
notice: Finished catalog run in 0.10 seconds

As mentioned in the other comment, a script may be easier to manage if you are just chaining the execs together, with no dependencies on any other puppet-managed resources.