Преглед изворни кода

Refactor can_be_scaled for clarity

Signed-off-by: Aanand Prasad <[email protected]>
Aanand Prasad пре 10 година
родитељ
комит
9ffe69a572
1 измењених фајлова са 4 додато и 4 уклоњено
  1. 4 4
      compose/service.py

+ 4 - 4
compose/service.py

@@ -157,7 +157,7 @@ class Service(object):
         - starts containers until there are at least `desired_num` running
         - removes all stopped containers
         """
-        if not self.can_be_scaled():
+        if self.specifies_host_port():
             log.warn('Service %s specifies a port on the host. If multiple containers '
                      'for this service are created on a single host, the port will clash.'
                      % self.name)
@@ -703,11 +703,11 @@ class Service(object):
             '{0}={1}'.format(LABEL_ONE_OFF, "True" if one_off else "False")
         ]
 
-    def can_be_scaled(self):
+    def specifies_host_port(self):
         for port in self.options.get('ports', []):
             if ':' in str(port):
-                return False
-        return True
+                return True
+        return False
 
     def pull(self, insecure_registry=False):
         if 'image' not in self.options: