Skip to content

Commit

Permalink
Added support for restart basing on service dependencies. (Fixes sign…
Browse files Browse the repository at this point in the history
  • Loading branch information
zsuzhengdu committed Apr 17, 2017
1 parent 10b2f41 commit 5d9a36f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions maestro/plays/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,13 @@ def _gather_dependencies(self, container):
result = set([container])

for container in result:
deps = container.service.requires if self._forward \
else container.service.needed_for
if self._play == 'restart':
deps = container.service.needed_for if self._forward \
else container.service.requires
else:
deps = container.service.requires if self._forward \
else container.service.needed_for

deps = functools.reduce(lambda x, y: x.union(y),
[s.containers for s in deps],
set([]))
Expand All @@ -180,7 +185,7 @@ def _gather_dependencies(self, container):

def _satisfied(self, container):
"""Returns True if all the dependencies of a given container have been
satisfied by what's been executed so far (or if it was explicitely
satisfied by what's been executed so far (or if it was explicitly
requested to ignore dependencies)."""
if self._ignore_dependencies:
return True
Expand Down

0 comments on commit 5d9a36f

Please sign in to comment.