From e9b6cc23fcf01d4768c7e082b7bc91b43ff84e7e Mon Sep 17 00:00:00 2001 From: Joel Barciauskas <barciajo@gmail.com> Date: Wed, 12 Apr 2017 17:45:09 -0400 Subject: [PATCH] Add --quiet parameter to docker-compose pull, using existing silent flag Signed-off-by: Joel Barciauskas <barciajo@gmail.com> --- compose/cli/main.py | 4 +++- compose/project.py | 6 +++--- tests/acceptance/cli_test.py | 4 ++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/compose/cli/main.py b/compose/cli/main.py index cfca0f949..20f3b55b4 100644 --- a/compose/cli/main.py +++ b/compose/cli/main.py @@ -634,11 +634,13 @@ class TopLevelCommand(object): Options: --ignore-pull-failures Pull what it can and ignores images with pull failures. --parallel Pull multiple images in parallel. + --quiet Pull without printing progress information """ self.project.pull( service_names=options['SERVICE'], ignore_pull_failures=options.get('--ignore-pull-failures'), - parallel_pull=options.get('--parallel') + parallel_pull=options.get('--parallel'), + silent=options.get('--quiet'), ) def push(self, options): diff --git a/compose/project.py b/compose/project.py index b282f718d..3ad971488 100644 --- a/compose/project.py +++ b/compose/project.py @@ -462,12 +462,12 @@ class Project(object): return plans - def pull(self, service_names=None, ignore_pull_failures=False, parallel_pull=False): + def pull(self, service_names=None, ignore_pull_failures=False, parallel_pull=False, silent=False): services = self.get_services(service_names, include_deps=False) if parallel_pull: def pull_service(service): - service.pull(ignore_pull_failures, True) + service.pull(ignore_pull_failures, True, silent=silent) parallel.parallel_execute( services, @@ -477,7 +477,7 @@ class Project(object): limit=5) else: for service in services: - service.pull(ignore_pull_failures) + service.pull(ignore_pull_failures, silent=silent) def push(self, service_names=None, ignore_push_failures=False): for service in self.get_services(service_names, include_deps=False): diff --git a/tests/acceptance/cli_test.py b/tests/acceptance/cli_test.py index dd95fb545..9a1f5364b 100644 --- a/tests/acceptance/cli_test.py +++ b/tests/acceptance/cli_test.py @@ -431,6 +431,10 @@ class CLITestCase(DockerClientTestCase): assert ('repository nonexisting-image not found' in result.stderr or 'image library/nonexisting-image:latest not found' in result.stderr) + def test_pull_with_quiet(self): + assert self.dispatch(['pull', '--quiet']).stderr == '' + assert self.dispatch(['pull', '--quiet']).stdout == '' + def test_build_plain(self): self.base_dir = 'tests/fixtures/simple-dockerfile' self.dispatch(['build', 'simple'])