Saurav
Saurav

Reputation: 424

Override the chef bash return code

I am running a chef recipie to install Websphere fixpacks. The fixpack retuns and exitcode [2] which is for partial install. Its an expected behaviour, but chef is just taking it as an error. Is there any way to override it.

I want chef to move ahead with the next task, even if the return exit code is [2]

================================================================================
Error executing action `run` on resource 'bash[was-install-fixpacks]'
================================================================================


Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '2'

Upvotes: 6

Views: 7723

Answers (1)

StephenKing
StephenKing

Reputation: 37580

A quick look into the documentation reveals the parameter returns:

The return value for a command. This may be an array of accepted values. An exception is raised when the return value(s) do not match. Default value: 0.

Example:

bash "was-install-fixpacks" do
  command ..
  returns [0, 2]
end

Upvotes: 13

Related Questions