docker_container: show warnings, fix/improve tests (#53440)

* Output warnings from docker daemon on container create and update.

* Accept warning for blkio_weight instead of idempotency.

* Value quoting.

* Avoid loop variable conflict.

* Add changelog.

* Make one test case faster.

* Add 'Docker warning: ' prefix.

* Add a generalized warning reporting function.
This commit is contained in:
Felix Fontein 2019-03-11 10:04:06 +01:00 committed by Will Thames
parent 7bb174214c
commit 3117900b1e
7 changed files with 89 additions and 67 deletions

View file

@ -2480,6 +2480,7 @@ class ContainerManager(DockerBaseClass):
if not self.check_mode:
try:
new_container = self.client.create_container(image, **create_parameters)
self.client.report_warnings(new_container)
except Exception as exc:
self.fail("Error creating container: %s" % str(exc))
return self._get_container(new_container['Id'])
@ -2572,7 +2573,8 @@ class ContainerManager(DockerBaseClass):
self.results['changed'] = True
if not self.check_mode and callable(getattr(self.client, 'update_container')):
try:
self.client.update_container(container_id, **update_parameters)
result = self.client.update_container(container_id, **update_parameters)
self.client.report_warnings(result)
except Exception as exc:
self.fail("Error updating container %s: %s" % (container_id, str(exc)))
return self._get_container(container_id)