From 732b6f0a2381b6b0810b9f01ff87918b31563fd2 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Thu, 11 Sep 2014 11:22:50 -0700 Subject: [PATCH] Omit tag from parsed image name Fixes #8925 --- cloud/docker | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/cloud/docker b/cloud/docker index d19a1f997ac..b831485e525 100644 --- a/cloud/docker +++ b/cloud/docker @@ -506,12 +506,15 @@ class DockerManager: def get_split_image_tag(self, image): - if '/' in image: - image = image.split('/')[-1] - tag = "latest" - if image.find(':') > 0: - return image.split(':') + # If image contains a host or org name, omit that from our check + resource = image.rsplit('/', 1)[-1] + + # now we can determine if image has a tag + if resource.find(':') > 0: + # Use image here so that host and org name are included + return image.split(':', 1) else: + tag = "latest" return image, tag def get_summary_counters_msg(self): @@ -626,7 +629,7 @@ class DockerManager: except: self.module.fail_json(msg="failed to login to the remote registry, check your username/password.") try: - self.client.pull(resource, tag=tag) + self.client.pull(image, tag=tag) except: self.module.fail_json(msg="failed to pull the specified image: %s" % resource) self.increment_counter('pull')