Commit 6f8692cd authored by Daniele Venzano's avatar Daniele Venzano

Do not try to get hostname when running on a docker engine

parent b0fb463a
......@@ -218,9 +218,12 @@ class SwarmClient:
"id": container.id,
"ip_address": {},
"name": container.name,
'host': container.attrs['Node']['Name'],
'labels': container.attrs['Config']['Labels']
} # type: Dict[str, Any]
try:
info['host'] = container.attrs['Node']['Name'],
except KeyError:
info['host'] = 'N/A'
for net in container.attrs["NetworkSettings"]["Networks"]:
if len(container.attrs["NetworkSettings"]["Networks"][net]['IPAddress']) > 0:
......
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