Merge lp:~raharper/curtin/trunk.retry-apt-commands into lp:~curtin-dev/curtin/trunk

Proposed by Ryan Harper
Status: Merged
Approved by: Scott Moser
Approved revision: 463
Merged at revision: 462
Proposed branch: lp:~raharper/curtin/trunk.retry-apt-commands
Merge into: lp:~curtin-dev/curtin/trunk
Diff against target: 42 lines (+7/-5)
2 files modified
curtin/commands/apt_config.py (+2/-1)
tests/unittests/test_apt_source.py (+5/-4)
To merge this branch: bzr merge lp:~raharper/curtin/trunk.retry-apt-commands
Reviewer Review Type Date Requested Status
Scott Moser (community) Approve
Server Team CI bot continuous-integration Approve
Joshua Powers (community) Approve
Review via email: mp+316888@code.launchpad.net

Description of the change

Make apt commands retry

We see transient failures in overnight runs where apt fails to connect to the archive for network reasons. Handle this by allowing our calls to apt to be retried.

To post a comment you must log in.
Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Joshua Powers (powersj) wrote :

LGTM

review: Approve
463. By Ryan Harper

Only retry add-apt-repository for now

Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Scott Moser (smoser) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'curtin/commands/apt_config.py'
2--- curtin/commands/apt_config.py 2017-02-02 22:52:01 +0000
3+++ curtin/commands/apt_config.py 2017-02-09 19:59:41 +0000
4@@ -408,7 +408,8 @@
5 target, sys_resolvconf=True) as in_chroot:
6 time_entered = time.time()
7 try:
8- in_chroot.subp(["add-apt-repository", source])
9+ in_chroot.subp(["add-apt-repository", source],
10+ retries=(1, 2, 5, 10))
11 except util.ProcessExecutionError:
12 LOG.exception("add-apt-repository failed.")
13 raise
14
15=== modified file 'tests/unittests/test_apt_source.py'
16--- tests/unittests/test_apt_source.py 2017-02-06 20:22:00 +0000
17+++ tests/unittests/test_apt_source.py 2017-02-09 19:59:41 +0000
18@@ -425,7 +425,8 @@
19 self._add_apt_sources(cfg, TARGET, template_params=params,
20 aa_repo_match=self.matcher)
21 mockobj.assert_any_call(['add-apt-repository',
22- 'ppa:smoser/cloud-init-test'], target=TARGET)
23+ 'ppa:smoser/cloud-init-test'],
24+ retries=(1, 2, 5, 10), target=TARGET)
25
26 # adding ppa should ignore filename (uses add-apt-repository)
27 self.assertFalse(os.path.isfile(self.aptlistfile))
28@@ -442,11 +443,11 @@
29 self._add_apt_sources(cfg, TARGET, template_params=params,
30 aa_repo_match=self.matcher)
31 calls = [call(['add-apt-repository', 'ppa:smoser/cloud-init-test'],
32- target=TARGET),
33+ retries=(1, 2, 5, 10), target=TARGET),
34 call(['add-apt-repository', 'ppa:smoser/cloud-init-test2'],
35- target=TARGET),
36+ retries=(1, 2, 5, 10), target=TARGET),
37 call(['add-apt-repository', 'ppa:smoser/cloud-init-test3'],
38- target=TARGET)]
39+ retries=(1, 2, 5, 10), target=TARGET)]
40 mockobj.assert_has_calls(calls, any_order=True)
41
42 # adding ppa should ignore all filenames (uses add-apt-repository)

Subscribers

People subscribed via source and target branches