From 1afcd63a86bd3358aec36dd95636b7d1e4fc54a6 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Wed, 20 Apr 2016 14:53:10 -0400 Subject: [PATCH] Better env handling Fixes #1379 --- formats/aci.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/formats/aci.py b/formats/aci.py index dc1029d68..421b6bcfa 100644 --- a/formats/aci.py +++ b/formats/aci.py @@ -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),