Quellcode durchsuchen

pull: Deprecate '--parallel' and enable it by default.

Signed-off-by: Matthieu Nottale <[email protected]>
Matthieu Nottale vor 7 Jahren
Ursprung
Commit
8336407830
2 geänderte Dateien mit 12 neuen und 11 gelöschten Zeilen
  1. 5 2
      compose/cli/main.py
  2. 7 9
      tests/acceptance/cli_test.py

+ 5 - 2
compose/cli/main.py

@@ -711,14 +711,17 @@ class TopLevelCommand(object):
 
         Options:
             --ignore-pull-failures  Pull what it can and ignores images with pull failures.
-            --parallel              Pull multiple images in parallel.
+            --parallel              Deprecated, pull multiple images in parallel (enabled by default).
+            --no-parallel           Disable parallel pulling.
             -q, --quiet             Pull without printing progress information
             --include-deps          Also pull services declared as dependencies
         """
+        if options.get('--parallel'):
+            log.warn('--parallel option is deprecated and will be removed in future versions.')
         self.project.pull(
             service_names=options['SERVICE'],
             ignore_pull_failures=options.get('--ignore-pull-failures'),
-            parallel_pull=options.get('--parallel'),
+            parallel_pull=not options.get('--no-parallel'),
             silent=options.get('--quiet'),
             include_deps=options.get('--include-deps'),
         )

+ 7 - 9
tests/acceptance/cli_test.py

@@ -545,13 +545,11 @@ class CLITestCase(DockerClientTestCase):
 
     def test_pull(self):
         result = self.dispatch(['pull'])
-        assert sorted(result.stderr.split('\n'))[1:] == [
-            'Pulling another (busybox:latest)...',
-            'Pulling simple (busybox:latest)...',
-        ]
+        assert 'Pulling simple' in result.stderr
+        assert 'Pulling another' in result.stderr
 
     def test_pull_with_digest(self):
-        result = self.dispatch(['-f', 'digest.yml', 'pull'])
+        result = self.dispatch(['-f', 'digest.yml', 'pull', '--no-parallel'])
 
         assert 'Pulling simple (busybox:latest)...' in result.stderr
         assert ('Pulling digest (busybox@'
@@ -561,7 +559,7 @@ class CLITestCase(DockerClientTestCase):
     def test_pull_with_ignore_pull_failures(self):
         result = self.dispatch([
             '-f', 'ignore-pull-failures.yml',
-            'pull', '--ignore-pull-failures']
+            'pull', '--ignore-pull-failures', '--no-parallel']
         )
 
         assert 'Pulling simple (busybox:latest)...' in result.stderr
@@ -576,7 +574,7 @@ class CLITestCase(DockerClientTestCase):
 
     def test_pull_with_parallel_failure(self):
         result = self.dispatch([
-            '-f', 'ignore-pull-failures.yml', 'pull', '--parallel'],
+            '-f', 'ignore-pull-failures.yml', 'pull'],
             returncode=1
         )
 
@@ -593,14 +591,14 @@ class CLITestCase(DockerClientTestCase):
 
     def test_pull_with_no_deps(self):
         self.base_dir = 'tests/fixtures/links-composefile'
-        result = self.dispatch(['pull', 'web'])
+        result = self.dispatch(['pull', '--no-parallel', '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'])
+        result = self.dispatch(['pull', '--no-parallel', '--include-deps', 'web'])
         assert sorted(result.stderr.split('\n'))[1:] == [
             'Pulling db (busybox:latest)...',
             'Pulling web (busybox:latest)...',