Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set a timeout in deploy_revision provider?

Tags:

chef-infra

I found a situation when chef had generated Chef::Exceptions::CommandTimeout exception in git clone command. Sometimes the time of git clone could be more than 10 minutes. How to set the timeout value for such situations in chef recipe?

like image 660
Sergei Avanesov Avatar asked Jan 28 '13 07:01

Sergei Avanesov


2 Answers

Timeout for the git provider seems to be fixed now.

Checkout the code at: https://github.com/opscode/chef/blob/master/lib/chef/provider/git.rb#L292

So for the git resource you can just add the timeout attribute, i.e.:

git /var/www do
  repository <githubrepo>
  action :sync
  user www-data
  group www-data
  timeout 1200
end
like image 72
thcipriani Avatar answered Oct 22 '22 01:10

thcipriani


There is no simple way of changing timeout, I mean by passing some attributes. You will have to overwrite run_options method in git provider. Check out When monkey patching a method, can you call the overridden method from the new implementation? for different possibilities.

like image 1
Draco Ater Avatar answered Oct 22 '22 00:10

Draco Ater