Omit tag from parsed image name

Fixes #8925
This commit is contained in:
Toshio Kuratomi 2014-09-11 11:22:50 -07:00
parent 7edcf21bdc
commit 732b6f0a23

View file

@ -506,12 +506,15 @@ class DockerManager:
def get_split_image_tag(self, image): def get_split_image_tag(self, image):
if '/' in image: # If image contains a host or org name, omit that from our check
image = image.split('/')[-1] resource = image.rsplit('/', 1)[-1]
tag = "latest"
if image.find(':') > 0: # now we can determine if image has a tag
return image.split(':') if resource.find(':') > 0:
# Use image here so that host and org name are included
return image.split(':', 1)
else: else:
tag = "latest"
return image, tag return image, tag
def get_summary_counters_msg(self): def get_summary_counters_msg(self):
@ -626,7 +629,7 @@ class DockerManager:
except: except:
self.module.fail_json(msg="failed to login to the remote registry, check your username/password.") self.module.fail_json(msg="failed to login to the remote registry, check your username/password.")
try: try:
self.client.pull(resource, tag=tag) self.client.pull(image, tag=tag)
except: except:
self.module.fail_json(msg="failed to pull the specified image: %s" % resource) self.module.fail_json(msg="failed to pull the specified image: %s" % resource)
self.increment_counter('pull') self.increment_counter('pull')