Pārlūkot izejas kodu

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

Signed-off-by: Kevin Boschert <[email protected]>
kcboschert 9 gadi atpakaļ
vecāks
revīzija
64b466c0bc
3 mainītis faili ar 20 papildinājumiem un 2 dzēšanām
  1. 2 0
      compose/cli/main.py
  2. 3 2
      compose/project.py
  3. 15 0
      tests/acceptance/cli_test.py

+ 2 - 0
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):

+ 3 - 2
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):

+ 15 - 0
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'])