【问题标题】:How to set a timeout in deploy_revision provider?如何在 deploy_revision 提供程序中设置超时?
【发布时间】:2013-01-11 12:01:50
【问题描述】:

我发现厨师在 git clone 命令中生成 Chef::Exceptions::CommandTimeout 异常的情况。有时 git clone 的时间可能超过 10 分钟。厨师食谱中这种情况如何设置超时值?

【问题讨论】:

  • 请不要忘记将答案标记为正确! :)

标签: chef-infra


【解决方案1】:

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

【讨论】:

    【解决方案2】:

    没有简单的方法来改变超时,我的意思是通过一些属性。您将不得不覆盖 git provider 中的 run_options 方法。查看When monkey patching a method, can you call the overridden method from the new implementation? 了解不同的可能性。

    【讨论】:

    • 谢谢,试试这个解决方案!
    【解决方案3】:

    这里有同样的问题。感谢您的提示。能够像这样编写猴子补丁:

    https://gist.github.com/mikesmullin/5660466

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-01-20
      • 2019-10-12
      • 2010-11-04
      • 1970-01-01
      • 2011-03-28
      • 1970-01-01
      • 1970-01-01
      • 2013-07-17
      相关资源
      最近更新 更多