Use a if/else instead to avoid loading possibly invalid values for Memory
This commit is contained in:
parent
af5e402b87
commit
950701ba3e
1 changed files with 4 additions and 4 deletions
|
@ -1039,10 +1039,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']
|
actual_mem = container['HostConfig']['Memory']
|
||||||
|
else:
|
||||||
#Use v1.18 API and earlier Memory element location
|
|
||||||
if docker_api_version <= 1.18:
|
|
||||||
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