~canonical-launchpad-branches/launchpad-buildd/trunk

« back to all changes in this revision

Viewing changes to lpbuildd/target/lxd.py

  • Committer: Colin Watson
  • Date: 2017-09-07 16:37:30 UTC
  • mfrom: (279.1.1 snapd-no-cdn)
  • Revision ID: cjwatson@canonical.com-20170907163730-xmtfby7gpon2ngcf
[r=wgrant] Run snapd with SNAPPY_STORE_NO_CDN=1, since the buildd network isn't
allowed to talk to the CDN.

Show diffs side-by-side

added added

removed removed

Lines of Context:
360
360
            raise BackendException(
361
361
                "Container failed to start within %d seconds" % timeout)
362
362
 
 
363
        # XXX cjwatson 2017-09-07: With LXD < 2.2 we can't create the
 
364
        # directory until the container has started.  We can get away with
 
365
        # this for the time being because snapd isn't in the buildd chroots.
 
366
        self.run(["mkdir", "-p", "/etc/systemd/system/snapd.service.d"])
 
367
        with tempfile.NamedTemporaryFile(mode="w+") as no_cdn_file:
 
368
            print(dedent("""\
 
369
                [Service]
 
370
                Environment=SNAPPY_STORE_NO_CDN=1
 
371
                """), file=no_cdn_file, end="")
 
372
            no_cdn_file.flush()
 
373
            os.fchmod(no_cdn_file.fileno(), 0o644)
 
374
            self.copy_in(
 
375
                no_cdn_file.name,
 
376
                "/etc/systemd/system/snapd.service.d/no-cdn.conf")
 
377
 
363
378
    def run(self, args, env=None, input_text=None, get_output=False,
364
379
            echo=False, **kwargs):
365
380
        """See `Backend`."""