mirror of https://github.com/docker/compose.git
Fix issue with infinite recursion when service_names is empty
Signed-off-by: Chris Corbyn <chris@w3style.co.uk>
This commit is contained in:
parent
14cbe40543
commit
949df97726
|
@ -104,7 +104,10 @@ class Project(object):
|
||||||
Raises NoSuchService if any of the named services do not exist.
|
Raises NoSuchService if any of the named services do not exist.
|
||||||
"""
|
"""
|
||||||
if service_names is None or len(service_names) == 0:
|
if service_names is None or len(service_names) == 0:
|
||||||
return [s for s in self.services if s.options['auto_start']]
|
return self.get_services(
|
||||||
|
service_names=[s.name for s in self.services if s.options['auto_start']],
|
||||||
|
include_links=include_links
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
unsorted = [self.get_service(name) for name in service_names]
|
unsorted = [self.get_service(name) for name in service_names]
|
||||||
services = [s for s in self.services if s in unsorted]
|
services = [s for s in self.services if s in unsorted]
|
||||||
|
@ -156,10 +159,19 @@ class Project(object):
|
||||||
return l
|
return l
|
||||||
|
|
||||||
def _prepend_with_links(self, acc, service):
|
def _prepend_with_links(self, acc, service):
|
||||||
linked_services = self.get_services(
|
if service in acc:
|
||||||
service_names=service.get_linked_names(),
|
return acc
|
||||||
include_links=True
|
|
||||||
)
|
linked_names = service.get_linked_names()
|
||||||
|
|
||||||
|
if len(linked_names) > 0:
|
||||||
|
linked_services = self.get_services(
|
||||||
|
service_names=linked_names,
|
||||||
|
include_links=True
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
linked_services = []
|
||||||
|
|
||||||
linked_services.append(service)
|
linked_services.append(service)
|
||||||
return acc + linked_services
|
return acc + linked_services
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue