Merge pull request #2268 from AdamWill/pull-18-stream

fix #2043: strip empty dict from end of 'pull' stream
This commit is contained in:
Toshio Kuratomi 2015-10-14 07:15:14 -07:00
commit 4c722dd99a

View file

@ -1392,6 +1392,11 @@ class DockerManager(object):
changes = list(self.client.pull(image, tag=tag, stream=True, **extra_params))
try:
last = changes[-1]
# seems Docker 1.8 puts an empty dict at the end of the
# stream; catch that and get the previous instead
# https://github.com/ansible/ansible-modules-core/issues/2043
if last.strip() == '{}':
last = changes[-2]
except IndexError:
last = '{}'
status = json.loads(last).get('status', '')