From 1646e7559129926f0b7a340577d7dbf864d267a6 Mon Sep 17 00:00:00 2001 From: Joffrey F Date: Tue, 18 Apr 2017 12:53:43 -0700 Subject: [PATCH] Properly relay errors in execute_convergence_plan Signed-off-by: Joffrey F --- compose/service.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/compose/service.py b/compose/service.py index 1e85772b7..13b327616 100644 --- a/compose/service.py +++ b/compose/service.py @@ -378,12 +378,16 @@ class Service(object): self.start_container(container) return container - return parallel_execute( + containers, errors = parallel_execute( range(i, i + scale), lambda n: create_and_start(self, n), lambda n: self.get_container_name(n), "Creating" - )[0] + ) + if errors: + raise OperationFailedError(errors.values()[0]) + + return containers def _execute_convergence_recreate(self, containers, scale, timeout, detached, start): if len(containers) > scale: @@ -395,12 +399,14 @@ class Service(object): container, timeout=timeout, attach_logs=not detached, start_new_container=start ) - containers = parallel_execute( + containers, errors = parallel_execute( containers, recreate, lambda c: c.name, "Recreating" - )[0] + ) + if errors: + raise OperationFailedError(errors.values()[0]) if len(containers) < scale: containers.extend(self._execute_convergence_create( scale - len(containers), detached, start @@ -412,13 +418,16 @@ class Service(object): self._downscale(containers[scale:], timeout) containers = containers[:scale] if start: - parallel_execute( + _, errors = parallel_execute( containers, lambda c: self.start_container_if_stopped(c, attach_logs=not detached), lambda c: c.name, "Starting" ) + if errors: + raise OperationFailedError(errors.values()[0]) + if len(containers) < scale: containers.extend(self._execute_convergence_create( scale - len(containers), detached, start