summaryrefslogtreecommitdiff
path: root/compose/parallel.py
diff options
context:
space:
mode:
authorIan Glen Neal <ian.gl.neal@gmail.com>2017-12-10 23:50:24 +0000
committerJoffrey F <joffrey@docker.com>2018-01-19 14:16:56 -0800
commit7591639c728744ac836b5e9dfe62b0963a78341e (patch)
tree351d4fde6c155a6abe28a4d31e0cb022d6aeb055 /compose/parallel.py
parent5d4ccafd35c32fbfe589cf466b4e674c430f10fe (diff)
Fix #5465 by catching a no-image exception in
get_container_data_volumes. The ImageNotFound exception is now bubbled up to the client, which prompts the user on the desired course of action (rebuild or abort). Added a case to the unit test to check that an empty existing image doesn't result in an exception. Closed old pull request #5466 because I did a rebase and it showed over 300 commits to merge, which I thought was messy. Signed-off-by: Ian Glen Neal <ian.gl.neal@gmail.com>
Diffstat (limited to 'compose/parallel.py')
-rw-r--r--compose/parallel.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/compose/parallel.py b/compose/parallel.py
index 3c0098c0..341ca2f5 100644
--- a/compose/parallel.py
+++ b/compose/parallel.py
@@ -8,6 +8,7 @@ from threading import Semaphore
from threading import Thread
from docker.errors import APIError
+from docker.errors import ImageNotFound
from six.moves import _thread as thread
from six.moves.queue import Empty
from six.moves.queue import Queue
@@ -53,10 +54,7 @@ def parallel_execute(objects, func, get_name, msg, get_deps=None, limit=None, pa
writer = ParallelStreamWriter(stream, msg)
- if parent_objects:
- display_objects = list(parent_objects)
- else:
- display_objects = objects
+ display_objects = list(parent_objects) if parent_objects else objects
for obj in display_objects:
writer.add_object(get_name(obj))
@@ -76,6 +74,12 @@ def parallel_execute(objects, func, get_name, msg, get_deps=None, limit=None, pa
if exception is None:
writer.write(get_name(obj), 'done', green)
results.append(result)
+ elif isinstance(exception, ImageNotFound):
+ # This is to bubble up ImageNotFound exceptions to the client so we
+ # can prompt the user if they want to rebuild.
+ errors[get_name(obj)] = exception.explanation
+ writer.write(get_name(obj), 'error', red)
+ error_to_reraise = exception
elif isinstance(exception, APIError):
errors[get_name(obj)] = exception.explanation
writer.write(get_name(obj), 'error', red)