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