docker: from API 1.10 dns and volumes_from should be passed to start()
This commit is contained in:
parent
bb3ce0c744
commit
71b5a11735
1 changed files with 10 additions and 2 deletions
|
@ -301,6 +301,7 @@ import sys
|
||||||
from urlparse import urlparse
|
from urlparse import urlparse
|
||||||
try:
|
try:
|
||||||
import docker.client
|
import docker.client
|
||||||
|
import docker.utils
|
||||||
from requests.exceptions import *
|
from requests.exceptions import *
|
||||||
except ImportError, e:
|
except ImportError, e:
|
||||||
HAS_DOCKER_PY = False
|
HAS_DOCKER_PY = False
|
||||||
|
@ -524,10 +525,8 @@ class DockerManager:
|
||||||
'command': self.module.params.get('command'),
|
'command': self.module.params.get('command'),
|
||||||
'ports': self.exposed_ports,
|
'ports': self.exposed_ports,
|
||||||
'volumes': self.volumes,
|
'volumes': self.volumes,
|
||||||
'volumes_from': self.module.params.get('volumes_from'),
|
|
||||||
'mem_limit': _human_to_bytes(self.module.params.get('memory_limit')),
|
'mem_limit': _human_to_bytes(self.module.params.get('memory_limit')),
|
||||||
'environment': self.env,
|
'environment': self.env,
|
||||||
'dns': self.module.params.get('dns'),
|
|
||||||
'hostname': self.module.params.get('hostname'),
|
'hostname': self.module.params.get('hostname'),
|
||||||
'detach': self.module.params.get('detach'),
|
'detach': self.module.params.get('detach'),
|
||||||
'name': self.module.params.get('name'),
|
'name': self.module.params.get('name'),
|
||||||
|
@ -535,6 +534,10 @@ class DockerManager:
|
||||||
'tty': self.module.params.get('tty'),
|
'tty': self.module.params.get('tty'),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if docker.utils.compare_version('1.10', self.client.version()['ApiVersion']) < 0:
|
||||||
|
params['dns'] = self.module.params.get('dns')
|
||||||
|
params['volumes_from'] = self.module.params.get('volumes_from')
|
||||||
|
|
||||||
def do_create(count, params):
|
def do_create(count, params):
|
||||||
results = []
|
results = []
|
||||||
for _ in range(count):
|
for _ in range(count):
|
||||||
|
@ -562,6 +565,11 @@ class DockerManager:
|
||||||
'privileged': self.module.params.get('privileged'),
|
'privileged': self.module.params.get('privileged'),
|
||||||
'links': self.links,
|
'links': self.links,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if docker.utils.compare_version('1.10', self.client.version()['ApiVersion']) >= 0:
|
||||||
|
params['dns'] = self.module.params.get('dns')
|
||||||
|
params['volumes_from'] = self.module.params.get('volumes_from')
|
||||||
|
|
||||||
for i in containers:
|
for i in containers:
|
||||||
self.client.start(i['Id'], **params)
|
self.client.start(i['Id'], **params)
|
||||||
self.increment_counter('started')
|
self.increment_counter('started')
|
||||||
|
|
Loading…
Reference in a new issue