Use a if/else instead to avoid loading possibly invalid values for Memory
This commit is contained in:
parent
77d1c896fe
commit
613fe54908
1 changed files with 4 additions and 4 deletions
|
@ -1011,10 +1011,10 @@ class DockerManager(object):
|
|||
except ValueError as e:
|
||||
self.module.fail_json(msg=str(e))
|
||||
|
||||
actual_mem = container['HostConfig']['Memory']
|
||||
|
||||
#Use v1.18 API and earlier Memory element location
|
||||
if docker_api_version <= 1.18:
|
||||
#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']
|
||||
|
||||
if expected_mem and actual_mem != expected_mem:
|
||||
|
|
Loading…
Reference in a new issue