sous-chefs / apt

Development repository for the apt cookbook
https://supermarket.chef.io/cookbooks/apt
Apache License 2.0
202 stars 266 forks source link

Adds the option to retry adding failing remote keys #166

Closed mimor closed 7 years ago

mimor commented 8 years ago

This patch makes it possible to retry fetching a failed keyfile from a remote server.

Example error:

================================================================================
Error executing action `add` on resource 'apt_repository[nginx]'
================================================================================
Errno::ENETUNREACH
------------------
remote_file[/tmp/kitchen/cache/nginx_signing.key] (/tmp/kitchen/cache/cookbooks/apt/providers/repository.rb line 86) had an error: Errno::ENETUNREACH: Network is unreachable - connect(2) for "nginx.org" port 80
Resource Declaration:
---------------------
4: apt_repository 'nginx' do
5:   uri "http://nginx.org/packages/#{node['platform']}"
6:   distribution node['lsb']['codename']
7:   components %w(nginx)
8:   key 'http://nginx.org/packages/keys/nginx_signing.key'
9:   only_if { node['nginx']['package'] == 'nginx' }
10:   not_if { node['recipes'].include? 'passenger' }
11: end
12:

By setting the node attributes keyserver_retries and keyserver_retry_delay you can determine how many times the action should be retried, or how many delay there should be between each retry.

tas50 commented 8 years ago

This will need to be rebased before we can perform a review

tas50 commented 7 years ago

This resource is no longer part of this cookbook and has been merged into chef-client itself. If you still want to tackle this change you'll want to make the change against the chef/chef repo now.