【发布时间】:2013-01-11 12:01:50
【问题描述】:
我发现厨师在 git clone 命令中生成 Chef::Exceptions::CommandTimeout 异常的情况。有时 git clone 的时间可能超过 10 分钟。厨师食谱中这种情况如何设置超时值?
【问题讨论】:
-
请不要忘记将答案标记为正确! :)
标签: chef-infra
我发现厨师在 git clone 命令中生成 Chef::Exceptions::CommandTimeout 异常的情况。有时 git clone 的时间可能超过 10 分钟。厨师食谱中这种情况如何设置超时值?
【问题讨论】:
标签: chef-infra
git 提供程序的超时现在似乎已修复。
查看代码:https://github.com/opscode/chef/blob/master/lib/chef/provider/git.rb#L292
因此,对于 git 资源,您只需添加 timeout 属性,即:
git /var/www do
repository <githubrepo>
action :sync
user www-data
group www-data
timeout 1200
end
【讨论】:
没有简单的方法来改变超时,我的意思是通过一些属性。您将不得不覆盖 git provider 中的 run_options 方法。查看When monkey patching a method, can you call the overridden method from the new implementation? 了解不同的可能性。
【讨论】:
这里有同样的问题。感谢您的提示。能够像这样编写猴子补丁:
【讨论】: