Sometimes I'll get transient DNS or HTTP errors when apt-get update runs. This is an attempt to compensate for these errors.
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.
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.
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.
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.
bundle install && bundle exec rake spec
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 https://github.com/puppetlabs/puppetlabs-apt.git
git checkout master
git fetch upstream
git merge upstream/master
git checkout feature/retry-update
git rebase master
Added retry to update operation
As far as I'm concerned, this is good to go.