大厨:如何在ruby块中增加Mixlib :: ShellOut的CommandTimout?

时间:2015-10-06 01:49:49

标签: ruby chef

我正在尝试使用基于Chef 11.10.4的客户端在Ubuntu 14.04系统上的厨师食谱中执行数据库数据加载。我在ruby块中进行数据加载,这是日志中错误的相关部分:

  

Mixlib :: ShellOut ::的CommandTimeout

     

命令在600秒后超时:

     

命令超出允许的执行时间,被TERM信号杀死。

     

[2015-10-06T01:24:00 + 00:00]错误:ruby_block [加载数据集](chef-virtuoso :: load line 178)出错:   Mixlib :: ShellOut :: CommandTimeout:命令在600s后超时:

任何人都知道如何在ruby块中将shell_out!的默认CommandTimeout增加到3600?

以下是配方失败的红宝石块:

::Chef::Recipe.send(:include, Chef::Mixin::ShellOut)

ruby_block "Load Dataset" do
  block do
    shell_out!(DATA_LOAD_COMMAND)
  end
end

1 个答案:

答案 0 :(得分:1)

According to mixlib-shellout code and chef mixin shell_out code you should be able to use the timeout option like this:

ruby_block "Load Dataset" do
  block do
    shell_out!(DATA_LOAD_COMMAND, :timeout => 3600)
  end
end

You don't have to send the Class into Recipe, it's already part of the DSL.