Extend up -t to pass timeout to stop running containers

Signed-off-by: Travis Thieman <travis.thieman@gmail.com>
This commit is contained in:
Travis Thieman
2015-05-28 09:28:02 -04:00
committed by Daniel Nephin
parent 60351a8e07
commit c24d5380e6
5 changed files with 38 additions and 9 deletions

View File

@@ -439,9 +439,9 @@ class TopLevelCommand(Command):
image needs to be updated. (EXPERIMENTAL)
--no-recreate If containers already exist, don't recreate them.
--no-build Don't build an image, even if it's missing
-t, --timeout TIMEOUT When attached, use this timeout in seconds
for the shutdown. (default: 10)
-t, --timeout TIMEOUT Use this timeout in seconds for container shutdown
when attached or when containers are already
running. (default: 10)
"""
insecure_registry = options['--allow-insecure-ssl']
detached = options['-d']
@@ -452,6 +452,7 @@ class TopLevelCommand(Command):
allow_recreate = not options['--no-recreate']
smart_recreate = options['--x-smart-recreate']
service_names = options['SERVICE']
timeout = int(options['--timeout']) if options['--timeout'] is not None else None
project.up(
service_names=service_names,
@@ -460,6 +461,7 @@ class TopLevelCommand(Command):
smart_recreate=smart_recreate,
insecure_registry=insecure_registry,
do_build=not options['--no-build'],
timeout=timeout
)
to_attach = [c for s in project.get_services(service_names) for c in s.containers()]
@@ -477,8 +479,7 @@ class TopLevelCommand(Command):
signal.signal(signal.SIGINT, handler)
print("Gracefully stopping... (press Ctrl+C again to force)")
timeout = options.get('--timeout')
params = {} if timeout is None else {'timeout': int(timeout)}
params = {} if timeout is None else {'timeout': timeout}
project.stop(service_names=service_names, **params)
def migrate_to_labels(self, project, _options):