Reduce the args of some functions by including presenters as part of the thread_args.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
Daniel Nephin 2016-03-07 15:58:25 -05:00
parent e8a93821d4
commit bf96edfe11
3 changed files with 9 additions and 9 deletions

View File

@ -88,7 +88,10 @@ class LogPrinter(object):
if not line: if not line:
if not thread_map: if not thread_map:
# There are no running containers left to tail, so exit
return return
# We got an empty line because of a timeout, but there are still
# active containers to tail, so continue
continue continue
self.output.write(line) self.output.write(line)

View File

@ -389,7 +389,7 @@ class TopLevelCommand(object):
} }
print("Attaching to", list_containers(containers)) print("Attaching to", list_containers(containers))
log_printer_from_project( log_printer_from_project(
project, self.project,
containers, containers,
options['--no-color'], options['--no-color'],
log_args).run() log_args).run()
@ -708,10 +708,7 @@ class TopLevelCommand(object):
raise UserError("--abort-on-container-exit and -d cannot be combined.") raise UserError("--abort-on-container-exit and -d cannot be combined.")
with up_shutdown_context(self.project, service_names, timeout, detached): with up_shutdown_context(self.project, service_names, timeout, detached):
# start the event stream first so we don't lose any events to_attach = self.project.up(
event_stream = project.events(service_names=service_names)
to_attach = project.up(
service_names=service_names, service_names=service_names,
start_deps=start_deps, start_deps=start_deps,
strategy=convergence_strategy_from_opts(options), strategy=convergence_strategy_from_opts(options),
@ -723,12 +720,12 @@ class TopLevelCommand(object):
return return
log_printer = log_printer_from_project( log_printer = log_printer_from_project(
project, self.project,
filter_containers_to_service_names(to_attach, service_names), filter_containers_to_service_names(to_attach, service_names),
options['--no-color'], options['--no-color'],
{'follow': True}, {'follow': True},
cascade_stop, cascade_stop,
event_stream=event_stream) event_stream=self.project.events(service_names=service_names))
print("Attaching to", list_containers(log_printer.containers)) print("Attaching to", list_containers(log_printer.containers))
log_printer.run() log_printer.run()

View File

@ -396,8 +396,8 @@ class CLITestCase(DockerClientTestCase):
self.base_dir = 'tests/fixtures/echo-services' self.base_dir = 'tests/fixtures/echo-services'
result = self.dispatch(['up', '--no-color']) result = self.dispatch(['up', '--no-color'])
assert 'simple_1 | simple' in result.stdout assert 'simple_1 | simple' in result.stdout
assert 'another_1 | another' in result.stdout assert 'another_1 | another' in result.stdout
assert 'simple_1 exited with code 0' in result.stdout assert 'simple_1 exited with code 0' in result.stdout
assert 'another_1 exited with code 0' in result.stdout assert 'another_1 exited with code 0' in result.stdout