mirror of https://github.com/docker/compose.git
Refactor can_be_scaled for clarity
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
This commit is contained in:
parent
6ca781416e
commit
9ffe69a572
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue