mirror of https://github.com/docker/compose.git
Pass toplevel_environment to run_one_off_container
Instead of passing `project_dir` from `TopLevelCommand.run` to `run_one_off_container` then using it there to load the toplevel environment (duplicating the logic that `TopLevelCommand.toplevel_environment` encapsulates), pass the Environment object. Signed-off-by: Klaas Hoekema <khoekema@azavea.com>
This commit is contained in:
parent
088a798e7a
commit
69c0683bfe
|
@ -887,7 +887,7 @@ class TopLevelCommand(object):
|
|||
container_options = build_one_off_container_options(options, detach, command)
|
||||
run_one_off_container(
|
||||
container_options, self.project, service, options,
|
||||
self.toplevel_options, self.project_dir
|
||||
self.toplevel_options, self.toplevel_environment
|
||||
)
|
||||
|
||||
def scale(self, options):
|
||||
|
@ -1325,7 +1325,7 @@ def build_one_off_container_options(options, detach, command):
|
|||
|
||||
|
||||
def run_one_off_container(container_options, project, service, options, toplevel_options,
|
||||
project_dir='.'):
|
||||
toplevel_environment):
|
||||
if not options['--no-deps']:
|
||||
deps = service.get_dependency_names()
|
||||
if deps:
|
||||
|
@ -1354,8 +1354,6 @@ def run_one_off_container(container_options, project, service, options, toplevel
|
|||
if options['--rm']:
|
||||
project.client.remove_container(container.id, force=True, v=True)
|
||||
|
||||
environment_file = toplevel_options.get('--env-file')
|
||||
toplevel_environment = Environment.from_env_file(project_dir, environment_file)
|
||||
use_cli = not toplevel_environment.get_boolean('COMPOSE_INTERACTIVE_NO_CLI')
|
||||
|
||||
signals.set_signal_handler_to_shutdown()
|
||||
|
|
Loading…
Reference in New Issue