Properly resolve environment from all sources.

Split env resolving into two phases. The first phase is to expand the paths
of env_files, which is done before merging extends. Once all files are merged
together, the final phase is to read the env_files and use them as the base
for environment variables.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
Daniel Nephin 2015-11-23 13:24:57 -05:00
commit fa975d7fbe
3 changed files with 64 additions and 69 deletions

View file

@ -7,7 +7,6 @@ from pytest import skip
from .. import unittest
from compose.cli.docker_client import docker_client
from compose.config.config import resolve_environment
from compose.config.config import ServiceConfig
from compose.const import LABEL_PROJECT
from compose.progress_stream import stream_output
from compose.service import Service
@ -39,9 +38,7 @@ class DockerClientTestCase(unittest.TestCase):
if 'command' not in kwargs:
kwargs['command'] = ["top"]
service_config = ServiceConfig('.', None, name, kwargs)
kwargs['environment'] = resolve_environment(service_config)
kwargs['environment'] = resolve_environment(kwargs)
labels = dict(kwargs.setdefault('labels', {}))
labels['com.docker.compose.test-name'] = self.id()