From 64b466c0bc56a871aee6c34e527789d4a5a658ed Mon Sep 17 00:00:00 2001 From: kcboschert Date: Wed, 27 Jan 2016 05:02:33 +0000 Subject: [PATCH] Add optional argument to pull dependencies on docker-compose pull. Signed-off-by: Kevin Boschert --- compose/cli/main.py | 2 ++ compose/project.py | 5 +++-- tests/acceptance/cli_test.py | 15 +++++++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/compose/cli/main.py b/compose/cli/main.py index 4319d0ada..edc07d426 100644 --- a/compose/cli/main.py +++ b/compose/cli/main.py @@ -677,12 +677,14 @@ class TopLevelCommand(object): --ignore-pull-failures Pull what it can and ignores images with pull failures. --parallel Pull multiple images in parallel. -q, --quiet Pull without printing progress information + --include-deps Also pull services declared as dependencies """ self.project.pull( service_names=options['SERVICE'], ignore_pull_failures=options.get('--ignore-pull-failures'), parallel_pull=options.get('--parallel'), silent=options.get('--quiet'), + include_deps=options.get('--include-deps'), ) def push(self, options): diff --git a/compose/project.py b/compose/project.py index 1880f39ad..5c7244493 100644 --- a/compose/project.py +++ b/compose/project.py @@ -537,8 +537,9 @@ class Project(object): return plans - def pull(self, service_names=None, ignore_pull_failures=False, parallel_pull=False, silent=False): - services = self.get_services(service_names, include_deps=False) + def pull(self, service_names=None, ignore_pull_failures=False, parallel_pull=False, silent=False, + include_deps=False): + services = self.get_services(service_names, include_deps) if parallel_pull: def pull_service(service): diff --git a/tests/acceptance/cli_test.py b/tests/acceptance/cli_test.py index 9dd03b72f..134485c40 100644 --- a/tests/acceptance/cli_test.py +++ b/tests/acceptance/cli_test.py @@ -567,6 +567,21 @@ class CLITestCase(DockerClientTestCase): result.stderr ) + def test_pull_with_no_deps(self): + self.base_dir = 'tests/fixtures/links-composefile' + result = self.dispatch(['pull', 'web']) + assert sorted(result.stderr.split('\n'))[1:] == [ + 'Pulling web (busybox:latest)...', + ] + + def test_pull_with_include_deps(self): + self.base_dir = 'tests/fixtures/links-composefile' + result = self.dispatch(['pull', '--include-deps', 'web']) + assert sorted(result.stderr.split('\n'))[1:] == [ + 'Pulling db (busybox:latest)...', + 'Pulling web (busybox:latest)...', + ] + def test_build_plain(self): self.base_dir = 'tests/fixtures/simple-dockerfile' self.dispatch(['build', 'simple'])