Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Added retry to update operation #193

merged 2 commits into from

3 participants

Ian Unruh Daniele Sluijters Hunter Haugen
Ian Unruh

Sometimes I'll get transient DNS or HTTP errors when apt-get update runs. This is an attempt to compensate for these errors.

Daniele Sluijters

I'm not a big fan of solving transient DNS or HTTP errors though 'oh heck just retry it' instead of finding the root cause of the issue but it can't really hurt either in this case.

@apenney @hunner: What do you guys think?

Btw the tests are failing on a syntax error in force_spec.rb from way back.

Daniele Sluijters

We discussed this is little and as-is we can't merge it. For most people a retry count of 1 is what they expect. In my case I wouldn't want a transient DNS error or whatever to cause another pass.

So, this should become configurable. It should be a parameter to the apt class which should default to either 1 or undef, in both cases that would cause the retry to be set to 1 since exec resources default to 1 if nothing is passed in.

Ian Unruh

I do agree that 3 tries was a bit excessive. In that case, I would just make the default be undef and let users decide how many times they want to retry.

Hunter Haugen

Thanks for updating this! Looks like it will need a rebase to merge though. Also, could you make sure the tests pass? @daenney mentions the force_spec.rb file will need updating; you can run them yourself by running bundle install && bundle exec rake spec in the module directory.

Daniele Sluijters

Actually, what I meant was that the original reason for the tests to fail on his pull request was a syntax error in force_spec.rb at the time. That syntax error was not @ianunruh's doing though.

In order to rebase your commit:

git remote add upstream
git checkout master
git fetch upstream
git merge upstream/master
git checkout feature/retry-update
git rebase master
Daniele Sluijters

As far as I'm concerned, this is good to go.

Hunter Haugen hunner merged commit 4d2819f into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 5, 2014
  1. Ian Unruh
  2. Ian Unruh

    Updated documentation

    ianunruh authored
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 0 deletions.
  1. +4 −0 manifests/init.pp
  2. +2 −0  manifests/update.pp
4 manifests/init.pp
@@ -14,6 +14,9 @@
# to true, Puppet will purge all unmanaged entries from sources.list.d
# update_timeout - Overrides the exec timeout in seconds for apt-get update.
# If not set defaults to Exec's default (300)
+# update_tries - Number of times that `apt-get update` will be tried. Use this
+# to work around transient DNS and HTTP errors. By default, the command
+# will only be run once.
# Actions:
@@ -32,6 +35,7 @@
$purge_preferences = false,
$purge_preferences_d = false,
$update_timeout = undef,
+ $update_tries = undef,
$sources = undef
) {
2  manifests/update.pp
@@ -6,5 +6,7 @@
logoutput => 'on_failure',
refreshonly => true,
timeout => $apt::update_timeout,
+ tries => $apt::update_tries,
+ try_sleep => 1
Something went wrong with that request. Please try again.