Better env handling

Fixes #1379
This commit is contained in:
Joseph Schorr 2016-04-20 14:53:10 -04:00
parent 3f73e53270
commit 1afcd63a86

View file

@ -177,6 +177,17 @@ class ACIImage(TarImageFormatter):
hostname = app.config['SERVER_HOSTNAME']
hostname = hostname.split(':', 1)[0]
# Calculate the environment variables.
docker_env_vars = config.get('Env', [])
env_vars = []
for var in docker_env_vars:
pieces = var.split('=')
if len(pieces) != 2:
continue
env_vars.append(pieces)
manifest = {
"acKind": "ImageManifest",
"acVersion": "0.6.1",
@ -202,8 +213,7 @@ class ACIImage(TarImageFormatter):
"group": config.get('Group', '') or 'root',
"eventHandlers": [],
"workingDirectory": config.get('WorkingDir', '') or '/',
"environment": [{"name": key, "value": value}
for (key, value) in [e.split('=') for e in config.get('Env', []) or []]],
"environment": [{"name": key, "value": value} for (key, value) in env_vars],
"isolators": ACIImage._build_isolators(config),
"mountPoints": ACIImage._build_volumes(config),
"ports": ACIImage._build_ports(config),