Docker does not output Status after pull anymore.

- Docker 1.12 on CemtoOS7 does not output status line anymore.
- Do not rely on Docker output to verify if the image was the latest.

(cherry picked from commit 5f3c887c38)
This commit is contained in:
Konrad Klimaszewski 2017-04-03 21:35:49 +02:00 committed by James Cammarata
parent b05b5b9347
commit 2e5b4a9b2c

View file

@ -430,13 +430,10 @@ class AnsibleDockerClient(Client):
Pull an image
'''
self.log("Pulling image %s:%s" % (name, tag))
alreadyToLatest = False
old_tag = self.find_image(name, tag)
try:
for line in self.pull(name, tag=tag, stream=True, decode=True):
self.log(line, pretty_print=True)
if line.get('status'):
if line.get('status').startswith('Status: Image is up to date for'):
alreadyToLatest = True
if line.get('error'):
if line.get('errorDetail'):
error_detail = line.get('errorDetail')
@ -448,6 +445,8 @@ class AnsibleDockerClient(Client):
except Exception as exc:
self.fail("Error pulling image %s:%s - %s" % (name, tag, str(exc)))
return self.find_image(name, tag), alreadyToLatest
new_tag = self.find_image(name, tag)
return new_tag, old_tag == new_tag