mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Expect module env vars to override Dockerfile ones.
This commit is contained in:
parent
4e7d766e8f
commit
ff0d0ceb70
1 changed files with 12 additions and 3 deletions
|
@ -846,11 +846,20 @@ class DockerManager(object):
|
|||
# actual_env is likely to include environment variables injected by
|
||||
# the Dockerfile.
|
||||
|
||||
expected_env = set(image['ContainerConfig']['Env'] or [])
|
||||
expected_env = {}
|
||||
|
||||
for image_env in image['ContainerConfig']['Env'] or []:
|
||||
name, value = image_env.split('=', 1)
|
||||
expected_env[name] = value
|
||||
|
||||
if self.env:
|
||||
for name, value in self.env.iteritems():
|
||||
expected_env.add("{}={}".format(name, value))
|
||||
actual_env = set(container['Config']['Env'] or [])
|
||||
expected_env[name] = value
|
||||
|
||||
actual_env = {}
|
||||
for container_env in container['Config']['Env'] or []:
|
||||
name, value = container_env.split('=', 1)
|
||||
actual_env[name] = value
|
||||
|
||||
if actual_env != expected_env:
|
||||
# Don't include the environment difference in the output.
|
||||
|
|
Loading…
Reference in a new issue