Add optional argument to pull dependencies on docker-compose pull.

Signed-off-by: Kevin Boschert <kcboschert@gmail.com>
This commit is contained in:
kcboschert 2016-01-27 05:02:33 +00:00 committed by Joffrey F
parent db5af97326
commit 64b466c0bc
3 changed files with 20 additions and 2 deletions

View File

@ -677,12 +677,14 @@ class TopLevelCommand(object):
--ignore-pull-failures Pull what it can and ignores images with pull failures. --ignore-pull-failures Pull what it can and ignores images with pull failures.
--parallel Pull multiple images in parallel. --parallel Pull multiple images in parallel.
-q, --quiet Pull without printing progress information -q, --quiet Pull without printing progress information
--include-deps Also pull services declared as dependencies
""" """
self.project.pull( self.project.pull(
service_names=options['SERVICE'], service_names=options['SERVICE'],
ignore_pull_failures=options.get('--ignore-pull-failures'), ignore_pull_failures=options.get('--ignore-pull-failures'),
parallel_pull=options.get('--parallel'), parallel_pull=options.get('--parallel'),
silent=options.get('--quiet'), silent=options.get('--quiet'),
include_deps=options.get('--include-deps'),
) )
def push(self, options): def push(self, options):

View File

@ -537,8 +537,9 @@ class Project(object):
return plans return plans
def pull(self, service_names=None, ignore_pull_failures=False, parallel_pull=False, silent=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) include_deps=False):
services = self.get_services(service_names, include_deps)
if parallel_pull: if parallel_pull:
def pull_service(service): def pull_service(service):

View File

@ -567,6 +567,21 @@ class CLITestCase(DockerClientTestCase):
result.stderr 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): def test_build_plain(self):
self.base_dir = 'tests/fixtures/simple-dockerfile' self.base_dir = 'tests/fixtures/simple-dockerfile'
self.dispatch(['build', 'simple']) self.dispatch(['build', 'simple'])