mirror of
https://github.com/docker/compose.git
synced 2025-07-28 08:04:09 +02:00
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
|
- starts containers until there are at least `desired_num` running
|
||||||
- removes all stopped containers
|
- 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 '
|
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.'
|
'for this service are created on a single host, the port will clash.'
|
||||||
% self.name)
|
% self.name)
|
||||||
@ -703,11 +703,11 @@ class Service(object):
|
|||||||
'{0}={1}'.format(LABEL_ONE_OFF, "True" if one_off else "False")
|
'{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', []):
|
for port in self.options.get('ports', []):
|
||||||
if ':' in str(port):
|
if ':' in str(port):
|
||||||
return False
|
return True
|
||||||
return True
|
return False
|
||||||
|
|
||||||
def pull(self, insecure_registry=False):
|
def pull(self, insecure_registry=False):
|
||||||
if 'image' not in self.options:
|
if 'image' not in self.options:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user