有没有办法将厨师退出代码发送到shell

时间:2016-12-06 11:48:05

标签: ruby chef chef-recipe

我们目前正在从shell脚本调用厨师食谱。厨师失败了自定义退出代码,如下所示。但是shell脚本的退出代码为1。因此,我可以使用此自定义退出代码使shell脚本失败。

FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 5)

2 个答案:

答案 0 :(得分:0)

不支持此功能。 Chef的退出代码具有特定含义,您可以在https://github.com/chef/chef-rfc/blob/master/rfc062-exit-status.md#exit-codes-in-use

中找到这些含义

答案 1 :(得分:0)

这是abit hacky,尝试使用export / set_env param ......

begin
    <yourcode>
rescue
    env 'error_code' do
      value '5'
    end
end

然后访问该env param并将其删除。