Merge pull request #1767 from ecliptik/devel
Use proper HostConfig element which contains the proper Memory value …
This commit is contained in:
commit
44d23ababd
1 changed files with 8 additions and 1 deletions
|
@ -964,6 +964,9 @@ class DockerManager(object):
|
||||||
running = self.get_running_containers()
|
running = self.get_running_containers()
|
||||||
current = self.get_inspect_containers(running)
|
current = self.get_inspect_containers(running)
|
||||||
|
|
||||||
|
#Get API version
|
||||||
|
api_version = self.client.version()['ApiVersion']
|
||||||
|
|
||||||
image = self.get_inspect_image()
|
image = self.get_inspect_image()
|
||||||
if image is None:
|
if image is None:
|
||||||
# The image isn't present. Assume that we're about to pull a new
|
# The image isn't present. Assume that we're about to pull a new
|
||||||
|
@ -1030,6 +1033,10 @@ class DockerManager(object):
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
self.module.fail_json(msg=str(e))
|
self.module.fail_json(msg=str(e))
|
||||||
|
|
||||||
|
#For v1.19 API and above use HostConfig, otherwise use Config
|
||||||
|
if docker_api_version >= 1.19:
|
||||||
|
actual_mem = container['HostConfig']['Memory']
|
||||||
|
else:
|
||||||
actual_mem = container['Config']['Memory']
|
actual_mem = container['Config']['Memory']
|
||||||
|
|
||||||
if expected_mem and actual_mem != expected_mem:
|
if expected_mem and actual_mem != expected_mem:
|
||||||
|
|
Loading…
Reference in a new issue