Handle exit code for server shutdown using Chef recipe and Rundeck

53 Views Asked by At

I wrote a Chef recipe shutdown the server. Server gets shutdown, but the exit code is 1. I'm trying to use this recipe in Rundeck. Since the exit code is non zero, it is treated as failure in Rundeck orchestration.

I tried adding returns parameter, still same issue. Any suggestions please.

execute 'shutdown_server' do
  command 'shutdown -h now'
  returns [0,1,-1]
  action :run
end
1

There are 1 best solutions below

0
MegaDrive68k On

Rundeck Jobs fail with any code other than zero. You should "wrap" your deployment in a Rundeck inline-script job that returns 0 for your specific condition. Check this answer.