Merge pull request #6991 from joshuaconner/bugfix_dont_send_wrong_params_to_dockerclient_start
Docker: don't send wrong parameters to client.start()
This commit is contained in:
commit
f068a4f26a
1 changed files with 6 additions and 7 deletions
13
cloud/docker
13
cloud/docker
|
@ -570,8 +570,7 @@ class DockerManager:
|
|||
'privileged': self.module.params.get('privileged'),
|
||||
'links': self.links,
|
||||
}
|
||||
|
||||
if docker.utils.compare_version('1.10', self.client.version()['ApiVersion']) >= 0:
|
||||
if docker.utils.compare_version('1.10', self.client.version()['ApiVersion']) >= 0 and hasattr(docker, '__version__') and docker.__version__ > '0.3.0':
|
||||
params['dns'] = self.module.params.get('dns')
|
||||
params['volumes_from'] = self.module.params.get('volumes_from')
|
||||
|
||||
|
@ -682,11 +681,11 @@ def main():
|
|||
|
||||
# start/stop containers
|
||||
if state in [ "running", "present" ]:
|
||||
|
||||
|
||||
# make sure a container with `name` exists, if not create and start it
|
||||
if name and "/" + name not in map(lambda x: x.get('Name'), deployed_containers):
|
||||
containers = manager.create_containers(1)
|
||||
if state == "present": #otherwise it get (re)started later anyways..
|
||||
if state == "present": #otherwise it get (re)started later anyways..
|
||||
manager.start_containers(containers)
|
||||
running_containers = manager.get_running_containers()
|
||||
deployed_containers = manager.get_deployed_containers()
|
||||
|
@ -695,18 +694,18 @@ def main():
|
|||
# make sure a container with `name` is running
|
||||
if name and "/" + name not in map(lambda x: x.get('Name'), running_containers):
|
||||
manager.start_containers(deployed_containers)
|
||||
|
||||
|
||||
# start more containers if we don't have enough
|
||||
elif delta > 0:
|
||||
containers = manager.create_containers(delta)
|
||||
manager.start_containers(containers)
|
||||
|
||||
|
||||
# stop containers if we have too many
|
||||
elif delta < 0:
|
||||
containers_to_stop = running_containers[0:abs(delta)]
|
||||
containers = manager.stop_containers(containers_to_stop)
|
||||
manager.remove_containers(containers_to_stop)
|
||||
|
||||
|
||||
facts = manager.get_running_containers()
|
||||
else:
|
||||
facts = manager.get_deployed_containers()
|
||||
|
|
Loading…
Reference in a new issue