1
0
mirror of https://github.com/home-assistant/supervisor.git synced 2025-12-24 12:29:08 +00:00

Self fix corrupt docker network (#1907)

This commit is contained in:
Pascal Vizeli
2020-08-13 17:50:39 +02:00
committed by GitHub
parent 8d7b15cbeb
commit dfaffe3ec5

View File

@@ -31,7 +31,15 @@ class DockerNetwork:
@property
def containers(self) -> List[docker.models.containers.Container]:
"""Return of connected containers from network."""
return self.network.containers
containers: List[docker.models.containers.Container] = []
for cid, data in self.network.attrs.get("Containers", {}).items():
try:
containers.append(self.docker.containers.get(cid))
except docker.errors.APIError as err:
_LOGGER.warning("Docker network is corrupt! %s - run autofix", err)
self.stale_cleanup(data.get("Name", cid))
return containers
@property
def gateway(self) -> IPv4Address: