Skip to content
Snippets Groups Projects
Commit d741eed9 authored by Jeffrey Zhang's avatar Jeffrey Zhang
Browse files

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
parent 437d232d
No related branches found
No related tags found
No related merge requests found
...@@ -635,11 +635,15 @@ class DockerWorker(object): ...@@ -635,11 +635,15 @@ class DockerWorker(object):
# We do not want to detach so we wait around for container to exit # We do not want to detach so we wait around for container to exit
if not self.params.get('detach'): if not self.params.get('detach'):
rc = self.dc.wait(self.params.get('name')) 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: if rc != 0:
self.module.fail_json( self.module.fail_json(
failed=True, failed=True,
changed=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'): if self.params.get('remove_on_exit'):
self.stop_container() self.stop_container()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment