Fixes #1434, Project.containers with service_names.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
This commit is contained in:
parent
4f40d0c168
commit
022f81711e
2 changed files with 30 additions and 2 deletions
|
|
@ -6,7 +6,7 @@ from functools import reduce
|
|||
from docker.errors import APIError
|
||||
|
||||
from .config import get_service_name_from_net, ConfigurationError
|
||||
from .const import LABEL_PROJECT, LABEL_ONE_OFF
|
||||
from .const import LABEL_PROJECT, LABEL_SERVICE, LABEL_ONE_OFF
|
||||
from .service import Service, check_for_legacy_containers
|
||||
from .container import Container
|
||||
|
||||
|
|
@ -276,6 +276,11 @@ class Project(object):
|
|||
all=stopped,
|
||||
filters={'label': self.labels(one_off=one_off)})]
|
||||
|
||||
def matches_service_names(container):
|
||||
if not service_names:
|
||||
return True
|
||||
return container.labels.get(LABEL_SERVICE) in service_names
|
||||
|
||||
if not containers:
|
||||
check_for_legacy_containers(
|
||||
self.client,
|
||||
|
|
@ -284,7 +289,7 @@ class Project(object):
|
|||
stopped=stopped,
|
||||
one_off=one_off)
|
||||
|
||||
return containers
|
||||
return filter(matches_service_names, containers)
|
||||
|
||||
def _inject_deps(self, acc, service):
|
||||
dep_names = service.get_dependency_names()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue