~cjwatson/launchpad-buildd/rename-slave-config-section

« back to all changes in this revision

Viewing changes to lpbuildd/snap.py

  • Committer: Colin Watson
  • Date: 2019-06-05 14:13:13 UTC
  • mfrom: (357.1.3 proxy-configs)
  • Revision ID: cjwatson@canonical.com-20190605141313-1bitx6ioodrxlhaz
[r=twom] Allow configuring APT or snap store proxies via a new [proxy] configuration file section.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2015-2018 Canonical Ltd.  This software is licensed under the
 
1
# Copyright 2015-2019 Canonical Ltd.  This software is licensed under the
2
2
# GNU Affero General Public License version 3 (see the file LICENSE).
3
3
 
4
4
from __future__ import print_function
29
29
        )
30
30
    from urlparse import urlparse
31
31
 
 
32
from six.moves.configparser import (
 
33
    NoOptionError,
 
34
    NoSectionError,
 
35
    )
32
36
from twisted.application import strports
33
37
from twisted.internet import reactor
34
38
from twisted.internet.interfaces import IHalfCloseableProtocol
351
355
            args.append("--build-source-tarball")
352
356
        if self.private:
353
357
            args.append("--private")
 
358
        try:
 
359
            snap_store_proxy_url = self._builder._config.get(
 
360
                "proxy", "snapstore")
 
361
            args.extend(["--snap-store-proxy-url", snap_store_proxy_url])
 
362
        except (NoSectionError, NoOptionError):
 
363
            pass
354
364
        args.append(self.name)
355
365
        self.runTargetSubProcess("buildsnap", *args)
356
366