Impose consistent behavior across command for --project-directory flag

Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
Joffrey F 2018-10-31 14:24:35 -07:00
parent 187f48e338
commit 176a4efaf2
2 changed files with 8 additions and 6 deletions

View File

@ -23,7 +23,8 @@ log = logging.getLogger(__name__)
def project_from_options(project_dir, options):
environment = Environment.from_env_file(project_dir)
override_dir = options.get('--project-directory')
environment = Environment.from_env_file(override_dir or project_dir)
set_parallel_limit(environment)
host = options.get('--host')
@ -37,7 +38,7 @@ def project_from_options(project_dir, options):
host=host,
tls_config=tls_config_from_options(options, environment),
environment=environment,
override_dir=options.get('--project-directory'),
override_dir=override_dir,
compatibility=options.get('--compatibility'),
)
@ -59,12 +60,13 @@ def set_parallel_limit(environment):
def get_config_from_options(base_dir, options):
environment = Environment.from_env_file(base_dir)
override_dir = options.get('--project-directory')
environment = Environment.from_env_file(override_dir or base_dir)
config_path = get_config_path_from_options(
base_dir, options, environment
)
return config.load(
config.find(base_dir, config_path, environment),
config.find(base_dir, config_path, environment, override_dir),
options.get('--compatibility')
)

View File

@ -306,7 +306,7 @@ class TopLevelCommand(object):
-o, --output PATH Path to write the bundle file to.
Defaults to "<project name>.dab".
"""
compose_config = get_config_from_options(self.project_dir, self.toplevel_options)
compose_config = get_config_from_options('.', self.toplevel_options)
output = options["--output"]
if not output:
@ -336,7 +336,7 @@ class TopLevelCommand(object):
or use the wildcard symbol to display all services
"""
compose_config = get_config_from_options(self.project_dir, self.toplevel_options)
compose_config = get_config_from_options('.', self.toplevel_options)
image_digests = None
if options['--resolve-image-digests']: