Merge lp:~cjwatson/launchpad-buildd/snapd-no-cdn into lp:launchpad-buildd

Proposed by Colin Watson
Status: Merged
Merged at revision: 280
Proposed branch: lp:~cjwatson/launchpad-buildd/snapd-no-cdn
Merge into: lp:launchpad-buildd
Diff against target: 81 lines (+31/-0)
3 files modified
debian/changelog (+7/-0)
lpbuildd/target/lxd.py (+15/-0)
lpbuildd/target/tests/test_lxd.py (+9/-0)
To merge this branch: bzr merge lp:~cjwatson/launchpad-buildd/snapd-no-cdn
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+330366@code.launchpad.net

Commit message

Run snapd with SNAPPY_STORE_NO_CDN=1, since the buildd network isn't
allowed to talk to the CDN.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2017-09-06 11:30:39 +0000
3+++ debian/changelog 2017-09-07 14:56:03 +0000
4@@ -1,3 +1,10 @@
5+launchpad-buildd (151) UNRELEASED; urgency=medium
6+
7+ * Run snapd with SNAPPY_STORE_NO_CDN=1, since the buildd network isn't
8+ allowed to talk to the CDN.
9+
10+ -- Colin Watson <cjwatson@ubuntu.com> Thu, 07 Sep 2017 15:52:10 +0100
11+
12 launchpad-buildd (150) xenial; urgency=medium
13
14 * Tell LXD to disable seccomp on powerpc, since it doesn't work there on
15
16=== modified file 'lpbuildd/target/lxd.py'
17--- lpbuildd/target/lxd.py 2017-09-06 09:39:12 +0000
18+++ lpbuildd/target/lxd.py 2017-09-07 14:56:03 +0000
19@@ -360,6 +360,21 @@
20 raise BackendException(
21 "Container failed to start within %d seconds" % timeout)
22
23+ # XXX cjwatson 2017-09-07: With LXD < 2.2 we can't create the
24+ # directory until the container has started. We can get away with
25+ # this for the time being because snapd isn't in the buildd chroots.
26+ self.run(["mkdir", "-p", "/etc/systemd/system/snapd.service.d"])
27+ with tempfile.NamedTemporaryFile(mode="w+") as no_cdn_file:
28+ print(dedent("""\
29+ [Service]
30+ Environment=SNAPPY_STORE_NO_CDN=1
31+ """), file=no_cdn_file, end="")
32+ no_cdn_file.flush()
33+ os.fchmod(no_cdn_file.fileno(), 0o644)
34+ self.copy_in(
35+ no_cdn_file.name,
36+ "/etc/systemd/system/snapd.service.d/no-cdn.conf")
37+
38 def run(self, args, env=None, input_text=None, get_output=False,
39 echo=False, **kwargs):
40 """See `Backend`."""
41
42=== modified file 'lpbuildd/target/tests/test_lxd.py'
43--- lpbuildd/target/tests/test_lxd.py 2017-09-06 09:31:04 +0000
44+++ lpbuildd/target/tests/test_lxd.py 2017-09-07 14:56:03 +0000
45@@ -200,6 +200,7 @@
46 iter([b"127.0.0.1\tlocalhost\n"]))
47 processes_fixture = self.useFixture(FakeProcesses())
48 processes_fixture.add(lambda _: {}, name="sudo")
49+ processes_fixture.add(lambda _: {}, name="lxc")
50 LXD("1", "xenial", "amd64").start()
51
52 self.assert_correct_profile()
53@@ -237,6 +238,9 @@
54 "--pid-file=/run/launchpad-buildd/dnsmasq.pid",
55 "--except-interface=lo", "--interface=lpbuilddbr0",
56 "--listen-address=10.10.10.1"]),
57+ Equals(
58+ ["lxc", "exec", "lp-xenial-amd64", "--", "linux64",
59+ "mkdir", "-p", "/etc/systemd/system/snapd.service.d"]),
60 ]))
61
62 client.containers.create.assert_called_once_with({
63@@ -263,6 +267,10 @@
64 params={"path": "/usr/local/sbin/policy-rc.d"},
65 data=policy_rc_d.encode("UTF-8"),
66 headers={"X-LXD-uid": 0, "X-LXD-gid": 0, "X-LXD-mode": "0755"})
67+ files_api.post.assert_any_call(
68+ params={"path": "/etc/systemd/system/snapd.service.d/no-cdn.conf"},
69+ data=b"[Service]\nEnvironment=SNAPPY_STORE_NO_CDN=1\n",
70+ headers={"X-LXD-uid": 0, "X-LXD-gid": 0, "X-LXD-mode": "0644"})
71 container.start.assert_called_once_with(wait=True)
72 self.assertEqual(LXD_RUNNING, container.status_code)
73
74@@ -291,6 +299,7 @@
75 }
76 processes_fixture = self.useFixture(FakeProcesses())
77 processes_fixture.add(lambda _: {}, name="sudo")
78+ processes_fixture.add(lambda _: {}, name="lxc")
79 LXD("1", "xenial", "amd64").start()
80
81 files_api.session.get.assert_called_once_with(

Subscribers

People subscribed via source and target branches

to all changes: