mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix bad commit from #8095 and fix bad splitting on :'s in the image
Fixes #8095 Fixes #8658
This commit is contained in:
parent
f4d649bea0
commit
92f7aa79b0
1 changed files with 17 additions and 10 deletions
|
@ -197,6 +197,14 @@ options:
|
||||||
default: false
|
default: false
|
||||||
aliases: []
|
aliases: []
|
||||||
version_added: "1.8"
|
version_added: "1.8"
|
||||||
|
registry:
|
||||||
|
description:
|
||||||
|
- The remote registry URL to use for pulling images.
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
aliases: []
|
||||||
|
version_added: "1.8"
|
||||||
|
|
||||||
author: Cove Schneider, Joshua Conner, Pavel Antonov
|
author: Cove Schneider, Joshua Conner, Pavel Antonov
|
||||||
requirements: [ "docker-py >= 0.3.0", "docker >= 0.10.0" ]
|
requirements: [ "docker-py >= 0.3.0", "docker >= 0.10.0" ]
|
||||||
'''
|
'''
|
||||||
|
@ -499,13 +507,6 @@ class DockerManager:
|
||||||
def get_split_image_tag(self, image):
|
def get_split_image_tag(self, image):
|
||||||
if '/' in image:
|
if '/' in image:
|
||||||
image = image.split('/')[-1]
|
image = image.split('/')[-1]
|
||||||
tag = None
|
|
||||||
if image.find(':') > 0:
|
|
||||||
return image.split(':')
|
|
||||||
else:
|
|
||||||
return image, tag
|
|
||||||
|
|
||||||
def get_split_full_image_tag(self, image):
|
|
||||||
tag = "latest"
|
tag = "latest"
|
||||||
if image.find(':') > 0:
|
if image.find(':') > 0:
|
||||||
return image.split(':')
|
return image.split(':')
|
||||||
|
@ -611,8 +612,13 @@ class DockerManager:
|
||||||
try:
|
try:
|
||||||
containers = do_create(count, params)
|
containers = do_create(count, params)
|
||||||
except:
|
except:
|
||||||
image, tag = self.get_split_full_image_tag(params['image'])
|
image, tag = self.get_split_image_tag(params['image'])
|
||||||
self.client.pull(image, tag = tag)
|
if self.module.params.get('username'):
|
||||||
|
self.client.login(self.module.params.get('username'),
|
||||||
|
password=self.module.params.get('password'),
|
||||||
|
email=self.module.params.get('email'),
|
||||||
|
registry=self.module.params.get('registry'))
|
||||||
|
self.client.pull(image, tag=tag)
|
||||||
self.increment_counter('pull')
|
self.increment_counter('pull')
|
||||||
containers = do_create(count, params)
|
containers = do_create(count, params)
|
||||||
|
|
||||||
|
@ -700,9 +706,10 @@ def main():
|
||||||
memory_swap = dict(default=0),
|
memory_swap = dict(default=0),
|
||||||
docker_url = dict(default='unix://var/run/docker.sock'),
|
docker_url = dict(default='unix://var/run/docker.sock'),
|
||||||
docker_api_version = dict(default=docker.client.DEFAULT_DOCKER_API_VERSION),
|
docker_api_version = dict(default=docker.client.DEFAULT_DOCKER_API_VERSION),
|
||||||
user = dict(default=None),
|
username = dict(default=None),
|
||||||
password = dict(),
|
password = dict(),
|
||||||
email = dict(),
|
email = dict(),
|
||||||
|
registry = dict(),
|
||||||
hostname = dict(default=None),
|
hostname = dict(default=None),
|
||||||
env = dict(type='dict'),
|
env = dict(type='dict'),
|
||||||
dns = dict(),
|
dns = dict(),
|
||||||
|
|
Loading…
Reference in a new issue