Jelajahi Sumber

Add '--quiet' option to 'up' to pull silently.

Signed-off-by: Matthieu Nottale <[email protected]>
Matthieu Nottale 7 tahun lalu
induk
melakukan
5eefa81f9e
3 mengubah file dengan 9 tambahan dan 5 penghapusan
  1. 3 1
      compose/cli/main.py
  2. 4 2
      compose/project.py
  3. 2 2
      compose/service.py

+ 3 - 1
compose/cli/main.py

@@ -934,6 +934,7 @@ class TopLevelCommand(object):
                                        print new container names. Incompatible with
                                        --abort-on-container-exit.
             --no-color                 Produce monochrome output.
+            --quiet-pull               Pull without printing progress information
             --no-deps                  Don't start linked services.
             --force-recreate           Recreate containers even if their configuration
                                        and image haven't changed.
@@ -998,7 +999,8 @@ class TopLevelCommand(object):
                     start=not no_start,
                     always_recreate_deps=always_recreate_deps,
                     reset_container_image=rebuild,
-                    renew_anonymous_volumes=options.get('--renew-anon-volumes')
+                    renew_anonymous_volumes=options.get('--renew-anon-volumes'),
+                    silent=options.get('--quiet-pull'),
                 )
 
             try:

+ 4 - 2
compose/project.py

@@ -446,7 +446,9 @@ class Project(object):
            start=True,
            always_recreate_deps=False,
            reset_container_image=False,
-           renew_anonymous_volumes=False):
+           renew_anonymous_volumes=False,
+           silent=False,
+           ):
 
         self.initialize()
         if not ignore_orphans:
@@ -460,7 +462,7 @@ class Project(object):
             include_deps=start_deps)
 
         for svc in services:
-            svc.ensure_image_exists(do_build=do_build)
+            svc.ensure_image_exists(do_build=do_build, silent=silent)
         plans = self._get_convergence_plans(
             services, strategy, always_recreate_deps=always_recreate_deps)
         scaled_services = self.get_scaled_services(services, scale_override)

+ 2 - 2
compose/service.py

@@ -305,7 +305,7 @@ class Service(object):
             raise OperationFailedError("Cannot create container for service %s: %s" %
                                        (self.name, ex.explanation))
 
-    def ensure_image_exists(self, do_build=BuildAction.none):
+    def ensure_image_exists(self, do_build=BuildAction.none, silent=False):
         if self.can_be_built() and do_build == BuildAction.force:
             self.build()
             return
@@ -317,7 +317,7 @@ class Service(object):
             pass
 
         if not self.can_be_built():
-            self.pull()
+            self.pull(silent=silent)
             return
 
         if do_build == BuildAction.skip: