[2.7] docker_container: don't parse/interpret options if state is 'absent' (#45769)

* Don't parse/interpret options if state is 'absent'. (#45700)

* Added changelog.
This commit is contained in:
Felix Fontein 2018-10-09 19:16:49 +02:00 committed by Toshio Kuratomi
parent 2293463320
commit 8715f96af0
2 changed files with 7 additions and 0 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- "Don't parse parameters and options when ``state`` is ``absent`` (https://github.com/ansible/ansible/pull/45700)."

View file

@ -753,6 +753,11 @@ class TaskParameters(DockerBaseClass):
for key, value in client.module.params.items(): for key, value in client.module.params.items():
setattr(self, key, value) setattr(self, key, value)
# If state is 'absent', parameters do not have to be parsed or interpreted.
# Only the container's name is needed.
if self.state == 'absent':
return
for param_name in REQUIRES_CONVERSION_TO_BYTES: for param_name in REQUIRES_CONVERSION_TO_BYTES:
if client.module.params.get(param_name): if client.module.params.get(param_name):
try: try: