parent
3871eebfbb
commit
6b3f7a82fb
1 changed files with 15 additions and 6 deletions
|
@ -612,13 +612,22 @@ class DockerManager:
|
||||||
try:
|
try:
|
||||||
containers = do_create(count, params)
|
containers = do_create(count, params)
|
||||||
except:
|
except:
|
||||||
image, tag = self.get_split_image_tag(params['image'])
|
resource = self.module.params.get('image')
|
||||||
|
image, tag = self.get_split_image_tag(resource)
|
||||||
if self.module.params.get('username'):
|
if self.module.params.get('username'):
|
||||||
self.client.login(self.module.params.get('username'),
|
try:
|
||||||
|
self.client.login(
|
||||||
|
self.module.params.get('username'),
|
||||||
password=self.module.params.get('password'),
|
password=self.module.params.get('password'),
|
||||||
email=self.module.params.get('email'),
|
email=self.module.params.get('email'),
|
||||||
registry=self.module.params.get('registry'))
|
registry=self.module.params.get('registry')
|
||||||
self.client.pull(image, tag=tag)
|
)
|
||||||
|
except:
|
||||||
|
self.module.fail_json(msg="failed to login to the remote registry, check your username/password.")
|
||||||
|
try:
|
||||||
|
self.client.pull(resource, tag=tag)
|
||||||
|
except:
|
||||||
|
self.module.fail_json(msg="failed to pull the specified image: %s" % resource)
|
||||||
self.increment_counter('pull')
|
self.increment_counter('pull')
|
||||||
containers = do_create(count, params)
|
containers = do_create(count, params)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue