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 thread_map:
# There are no running containers left to tail, so exit
return
# We got an empty line because of a timeout, but there are still
# active containers to tail, so continue
continue
self.output.write(line)

View File

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

View File

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