Commit 26ebf006 authored by André Anjos's avatar André Anjos 💬
Browse files

Make sure docker host ip is set at setup(); Be more cautious with unavailable images

parent a1ed95f3
Pipeline #4300 failed with stage
in 2 minutes and 11 seconds
......@@ -92,6 +92,9 @@ class Host(object):
self.environments = self._discover_environments(raise_on_errors=True)
# makes sure we can talk to the docker host
assert self.ip
def __contains__(self, key):
return key in self.environments
......@@ -346,15 +349,16 @@ class Host(object):
def get_statusoutput(self, image, command, **kwargs):
'''Runs a command and retrieves status and output'''
container = self.create_container(image=image, command=command, **kwargs)
container = None
try:
container = self.create_container(image=image, command=command, **kwargs)
self.start(container)
status = self.client.wait(container)
output = self.client.logs(container)
except Exception:
return 1, None
finally:
self.rm(container)
if container is not None: self.rm(container)
return status, output
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment