From 5db3cd60d4e5bd4c320cc23ba7cda6f619522d62 Mon Sep 17 00:00:00 2001 From: Drew Romanyk Date: Wed, 29 Nov 2017 21:06:45 -0600 Subject: [PATCH] Reword & Optimize getting stopped containers & update tests Signed-off-by: Drew Romanyk --- compose/cli/main.py | 2 +- compose/project.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/compose/cli/main.py b/compose/cli/main.py index 14471cf34..338566c72 100644 --- a/compose/cli/main.py +++ b/compose/cli/main.py @@ -918,7 +918,7 @@ class TopLevelCommand(object): --no-deps Don't start linked services. --force-recreate Recreate containers even if their configuration and image haven't changed. - --always-recreate-deps Recreate dependant containers. + --always-recreate-deps Recreate dependent containers. Incompatible with --no-recreate. --no-recreate If containers already exist, don't recreate them. Incompatible with --force-recreate. diff --git a/compose/project.py b/compose/project.py index f7a55d966..b4dbb817a 100644 --- a/compose/project.py +++ b/compose/project.py @@ -520,8 +520,8 @@ class Project(object): log.debug('%s has upstream changes (%s)', service.name, ", ".join(updated_dependencies)) - containers_stopped = any((not c.is_paused and not c.is_restarting and not c.is_running - for c in service.containers(stopped=True))) + containers_stopped = len( + service.containers(stopped=True, filters={'status': ['created', 'exited']})) > 0 has_links = any(c.get('HostConfig.Links') for c in service.containers()) if always_recreate_deps or containers_stopped or not has_links: plan = service.convergence_plan(ConvergenceStrategy.always)