From 3dab1785ba1a275be6de1b793d6f1c2a37058945 Mon Sep 17 00:00:00 2001 From: chouseknecht Date: Fri, 5 Aug 2016 14:20:52 -0400 Subject: [PATCH] Always returns changed when state present and name includes :tag. --- lib/ansible/modules/cloud/docker/docker_image.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/cloud/docker/docker_image.py b/lib/ansible/modules/cloud/docker/docker_image.py index bbc9086d74f..e5574bd6575 100644 --- a/lib/ansible/modules/cloud/docker/docker_image.py +++ b/lib/ansible/modules/cloud/docker/docker_image.py @@ -116,7 +116,8 @@ options: tag: description: - Used to select an image when pulling. Will be added to the image when pushing, tagging or building. Defaults to - C(latest). + I(latest). + - If C(name) parameter format is I(name:tag), then tag value from C(name) will take precedence. default: latest required: false container_limits: @@ -258,6 +259,12 @@ class ImageManager(DockerBaseClass): self.http_timeout = parameters.get('http_timeout') self.push = parameters.get('push') + # If name contains a tag, it takes precedence over tag parameter. + repo, repo_tag = parse_repository_tag(self.name) + if repo_tag: + self.name = repo + self.tag = repo_tag + if self.state in ['present', 'build']: self.present() elif self.state == 'absent':