aboutsummaryrefslogtreecommitdiff
path: root/kolla/cmd
diff options
context:
space:
mode:
authorPaul Bourke <paul.bourke@oracle.com>2016-01-14 11:41:35 +0000
committerPaul Bourke <paul.bourke@oracle.com>2016-01-18 11:53:25 +0000
commitb82111d589cf3f82cbe115d002b29eee959a428f (patch)
treee9c885e465711d6a42a1e756b68159c3b3a4eb21 /kolla/cmd
parent7093d37f1825182366939cf64faa477040d29aa2 (diff)
downloadkolla-b82111d589cf3f82cbe115d002b29eee959a428f.tar.gz
kolla-b82111d589cf3f82cbe115d002b29eee959a428f.zip
Pick up proxy buildargs from environment
We currently support any buildarg via --build-args. This patch picks up the default supported proxy buildargs if set in the user's environment, to allow for more transparent proxy support. The --build-args will take precendence. DocImpact Implements blueprint: better-proxy-support Change-Id: I084e5d1cc8f9993d65167878f9983ad58a68e86e
Diffstat (limited to 'kolla/cmd')
-rwxr-xr-xkolla/cmd/build.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/kolla/cmd/build.py b/kolla/cmd/build.py
index aff472d83..e27599751 100755
--- a/kolla/cmd/build.py
+++ b/kolla/cmd/build.py
@@ -204,6 +204,23 @@ class WorkerThread(Thread):
return dest_archive
+ def update_buildargs(self):
+ buildargs = dict()
+ if self.conf.build_args:
+ buildargs = dict(self.conf.build_args)
+
+ proxy_vars = ('HTTP_PROXY', 'http_proxy', 'HTTPS_PROXY',
+ 'https_proxy', 'FTP_PROXY', 'ftp_proxy',
+ 'NO_PROXY', 'no_proxy')
+
+ for proxy_var in proxy_vars:
+ if proxy_var in os.environ and proxy_var not in buildargs:
+ buildargs[proxy_var] = os.environ.get(proxy_var)
+
+ if not buildargs:
+ return None
+ return buildargs
+
def builder(self, image):
LOG.debug('%s:Processing', image['name'])
if image['status'] == 'unmatched':
@@ -256,13 +273,14 @@ class WorkerThread(Thread):
pull = True if image['parent'] is None else False
image['logs'] = str()
+ buildargs = self.update_buildargs()
for response in self.dc.build(path=image['path'],
tag=image['fullname'],
nocache=self.nocache,
rm=True,
pull=pull,
forcerm=self.forcerm,
- buildargs=self.conf.build_args):
+ buildargs=buildargs):
stream = json.loads(response.decode('utf-8'))
if 'stream' in stream: