Commit c2b8387d authored by Samuel GAIST's avatar Samuel GAIST

[dock] Handle docker exception following the raise on error property

IF docker is installed or the daemon not accessible, the exception
propagation will not follow the raise on error property. This patch
fixes that and thus keeps the behaviour consistant.
parent 13188307
Pipeline #36620 passed with stage
in 34 minutes and 38 seconds
......@@ -416,11 +416,31 @@ class Host(object):
client = docker.from_env()
databases = client.images.list(filters={"label": ["beat.env.type=database"]})
db_environments = _process_image_list(databases)
try:
databases = client.images.list(
filters={"label": ["beat.env.type=database"]}
)
except Exception as e:
if self.raise_on_errors:
raise
else:
logger.error("Docker error: {}".format(e))
return {}, {}
else:
db_environments = _process_image_list(databases)
executors = client.images.list(filters={"label": ["beat.env.type=execution"]})
environments = _process_image_list(executors)
try:
executors = client.images.list(
filters={"label": ["beat.env.type=execution"]}
)
except Exception as e:
if self.raise_on_errors:
raise
else:
logger.error("Docker error: {}".format(e))
return {}, {}
else:
environments = _process_image_list(executors)
logger.debug(
"Found %d environments and %d database environments",
......
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