From 876bdb62e1b4602a6722a7e1a20478f42f4816de Mon Sep 17 00:00:00 2001 From: Aaron Boushley Date: Fri, 9 Oct 2015 16:11:44 -0700 Subject: [PATCH] Fix issue with comparing versions improperly. This allows old versions of docker api to function. --- lib/ansible/modules/cloud/docker/docker.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/cloud/docker/docker.py b/lib/ansible/modules/cloud/docker/docker.py index 637aa76f7a2..01dbf3001a3 100644 --- a/lib/ansible/modules/cloud/docker/docker.py +++ b/lib/ansible/modules/cloud/docker/docker.py @@ -1109,7 +1109,7 @@ class DockerManager(object): self.module.fail_json(msg=str(e)) #For v1.19 API and above use HostConfig, otherwise use Config - if api_version >= 1.19: + if docker.utils.compare_version('1.19', api_version) >= 0: actual_mem = container['HostConfig']['Memory'] else: actual_mem = container['Config']['Memory'] @@ -1483,7 +1483,7 @@ class DockerManager(object): params['host_config'] = self.create_host_config() #For v1.19 API and above use HostConfig, otherwise use Config - if api_version < 1.19: + if docker.utils.compare_version('1.19', api_version) < 0: params['mem_limit'] = mem_limit else: params['host_config']['Memory'] = mem_limit