Make kollda_docker works with new released python docker 3.0 package
the wait function in docker 3.0 return a dict now. Closes-Bug: #1746748 Change-Id: Ice87128a936e36a0d7eb75c1ffd57dae39d89a64
This commit is contained in:
parent
437d232dc4
commit
d741eed94f
@ -635,11 +635,15 @@ class DockerWorker(object):
|
||||
# We do not want to detach so we wait around for container to exit
|
||||
if not self.params.get('detach'):
|
||||
rc = self.dc.wait(self.params.get('name'))
|
||||
# NOTE(jeffrey4l): since python docker package 3.0, wait return a
|
||||
# dict all the time.
|
||||
if isinstance(rc, dict):
|
||||
rc = rc['StatusCode']
|
||||
if rc != 0:
|
||||
self.module.fail_json(
|
||||
failed=True,
|
||||
changed=True,
|
||||
msg="Container exited with non-zero return code"
|
||||
msg="Container exited with non-zero return code %s" % rc
|
||||
)
|
||||
if self.params.get('remove_on_exit'):
|
||||
self.stop_container()
|
||||
|
Loading…
x
Reference in New Issue
Block a user