From 2e5b4a9b2c2026ac3f41c9ab0442e62742784eda Mon Sep 17 00:00:00 2001 From: Konrad Klimaszewski Date: Mon, 3 Apr 2017 21:35:49 +0200 Subject: [PATCH] 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 5f3c887c384d5185e6ef2398339b802062fdbc85) --- lib/ansible/module_utils/docker_common.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/ansible/module_utils/docker_common.py b/lib/ansible/module_utils/docker_common.py index c143b2b2c64..0321920a92f 100644 --- a/lib/ansible/module_utils/docker_common.py +++ b/lib/ansible/module_utils/docker_common.py @@ -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