Merge lp:~paelzer/curtin/curtin-bug-1645680-gpgagent into lp:~curtin-dev/curtin/trunk

Proposed by Christian Ehrhardt 
Status: Merged
Merged at revision: 434
Proposed branch: lp:~paelzer/curtin/curtin-bug-1645680-gpgagent
Merge into: lp:~curtin-dev/curtin/trunk
Diff against target: 39 lines (+15/-6)
1 file modified
curtin/commands/apt_config.py (+15/-6)
To merge this branch: bzr merge lp:~paelzer/curtin/curtin-bug-1645680-gpgagent
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
curtin developers Pending
Review via email: mp+312143@code.launchpad.net

Commit message

Workaround gpg-agent/dirmngr spawned daemons by add-apt-repository.

Kill dirmngr/gpg-agent after add-apt-repository as an interim workaround.
The failure occurs only when gpg2 is used, so only on yakkety or newer.

Add a Yakkety test to excercise this path.

Description of the change

A fix - or better interim workaround - for bug 1645680.

Looks good in make check and works on my system when tested with the apt feature to add ppa's on Zesty.

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
Scott Moser (smoser) wrote :

My primary comment is that I dont know that I like this being in ChrootableTarget.
Putting it there, as opposed to a wrapper around that makes it seem more legitimate than the ugly hack that it is.

other comments in line.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Hi Scott,
it is a hack as intended :-)

The main reason to make it part of ChrootableTarget is that it has to happen before the exit path of ChrootableTarget which does the umount.

We could try to make it part of the "with ChrootableTarget" section.
That would get rid of the flag as well and much more - rest of feedback ok and commented inline.

Testing new version and pushing soon.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Test with new version http://paste.ubuntu.com/23558651/
See line 1198 for the "effect" of the fix.

Looks much nicer as overall diff (located very close to the issue)
... pushing

434. By Christian Ehrhardt 

make fix local to the add-apt-repository call

Along that integrate some minor review feedback.

Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)
435. By Christian Ehrhardt 

move cleanup in a finally statement

Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ryan Harper (raharper) :
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Adapted some of the suggestions (and explained at the comments why not all), thanks Ryan for looking into it.

Tested and pushing ...

436. By Christian Ehrhardt 

use regexp to have only one killall

Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Thanks for merging.
Sorry on the chars, actually my git commits are autocolored and 80 char
blocked - need to get that for my bzr as well.
Or might we move curtin to git as well?

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 2016-11-14 22:55:12 +0000
3+++ curtin/commands/apt_config.py 2016-12-01 07:12:43 +0000
4@@ -24,6 +24,7 @@
5 import os
6 import re
7 import sys
8+import time
9 import yaml
10
11 from curtin.log import LOG
12@@ -402,13 +403,21 @@
13 ent['filename'] += ".list"
14
15 if aa_repo_match(source):
16- try:
17- with util.ChrootableTarget(
18- target, sys_resolvconf=True) as in_chroot:
19+ with util.ChrootableTarget(
20+ target, sys_resolvconf=True) as in_chroot:
21+ time_entered = time.time()
22+ try:
23 in_chroot.subp(["add-apt-repository", source])
24- except util.ProcessExecutionError:
25- LOG.exception("add-apt-repository failed.")
26- raise
27+ except util.ProcessExecutionError:
28+ LOG.exception("add-apt-repository failed.")
29+ raise
30+ finally:
31+ # workaround to gnupg >=2.x spawning daemons (LP: #1645680)
32+ seconds_since = time.time() - time_entered + 1
33+ in_chroot.subp(['killall', '--wait', '--quiet',
34+ '--younger-than', '%ds' % seconds_since,
35+ '--regexp', '(dirmngr|gpg-agent)'],
36+ rcs=[0, 1])
37 continue
38
39 sourcefn = util.target_path(target, ent['filename'])

Subscribers

People subscribed via source and target branches