mirror of https://github.com/docker/compose.git
Unify toplevel command handlers
Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
parent
7ce5766f6a
commit
a7d1fada52
|
@ -116,9 +116,9 @@ def perform_command(options, handler, command_options):
|
|||
handler(command_options)
|
||||
return
|
||||
|
||||
if options['COMMAND'] in ('config', 'bundle'):
|
||||
command = TopLevelCommand(None)
|
||||
handler(command, options, command_options)
|
||||
if options['COMMAND'] == 'config':
|
||||
command = TopLevelCommand(None, options=options)
|
||||
handler(command, command_options)
|
||||
return
|
||||
|
||||
project = project_from_options('.', options)
|
||||
|
@ -279,7 +279,7 @@ class TopLevelCommand(object):
|
|||
memory=options.get('--memory'),
|
||||
build_args=build_args)
|
||||
|
||||
def bundle(self, config_options, options):
|
||||
def bundle(self, options):
|
||||
"""
|
||||
Generate a Distributed Application Bundle (DAB) from the Compose file.
|
||||
|
||||
|
@ -298,8 +298,7 @@ class TopLevelCommand(object):
|
|||
-o, --output PATH Path to write the bundle file to.
|
||||
Defaults to "<project name>.dab".
|
||||
"""
|
||||
self.project = project_from_options('.', config_options)
|
||||
compose_config = get_config_from_options(self.project_dir, config_options)
|
||||
compose_config = get_config_from_options(self.project_dir, self.toplevel_options)
|
||||
|
||||
output = options["--output"]
|
||||
if not output:
|
||||
|
@ -312,7 +311,7 @@ class TopLevelCommand(object):
|
|||
|
||||
log.info("Wrote bundle to {}".format(output))
|
||||
|
||||
def config(self, config_options, options):
|
||||
def config(self, options):
|
||||
"""
|
||||
Validate and view the Compose file.
|
||||
|
||||
|
@ -327,11 +326,12 @@ class TopLevelCommand(object):
|
|||
|
||||
"""
|
||||
|
||||
compose_config = get_config_from_options(self.project_dir, config_options)
|
||||
compose_config = get_config_from_options(self.project_dir, self.toplevel_options)
|
||||
image_digests = None
|
||||
|
||||
if options['--resolve-image-digests']:
|
||||
self.project = project_from_options('.', config_options)
|
||||
self.project = project_from_options('.', self.toplevel_options)
|
||||
with errors.handle_connection_errors(self.project.client):
|
||||
image_digests = image_digests_for_project(self.project)
|
||||
|
||||
if options['--quiet']:
|
||||
|
@ -1144,7 +1144,6 @@ def timeout_from_opts(options):
|
|||
|
||||
|
||||
def image_digests_for_project(project, allow_push=False):
|
||||
with errors.handle_connection_errors(project.client):
|
||||
try:
|
||||
return get_image_digests(
|
||||
project,
|
||||
|
|
Loading…
Reference in New Issue