docker_image: Fix idempotency of pull (#31956)
when pulling an image with force=yes the task was marked as changed everytime even when the image hasn't changed. This was due to a bad comparison of the image tag before the pull and after the pull. Fixes #22596 Signed-off-by: Alberto Murillo <albertomurillosilva@gmail.com>
This commit is contained in:
parent
d13eccb7bc
commit
0f3480d359
1 changed files with 2 additions and 2 deletions
|
@ -336,8 +336,8 @@ class ImageManager(DockerBaseClass):
|
|||
self.results['actions'].append('Pulled image %s:%s' % (self.name, self.tag))
|
||||
self.results['changed'] = True
|
||||
if not self.check_mode:
|
||||
self.results['image'] = self.client.pull_image(self.name, tag=self.tag)
|
||||
if image and image == self.results['image']:
|
||||
self.results['image'], already_latest = self.client.pull_image(self.name, tag=self.tag)
|
||||
if already_latest:
|
||||
self.results['changed'] = False
|
||||
|
||||
if self.archive_path:
|
||||
|
|
Loading…
Reference in a new issue