Fix small bug on docker network

This commit is contained in:
Iglesys 2022-11-21 15:19:47 +01:00 committed by GitHub
parent 5d863a503f
commit 9320445074
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,10 +13,12 @@ def get_tor_ips():
containers = [
container for container in containers
if (container.attrs["NetworkSettings"]["Networks"]["net_tor"]["NetworkID"] == net_tor_id)
if ("net_tor" in container.attrs["NetworkSettings"]["Networks"])
and (container.attrs["NetworkSettings"]["Networks"]["net_tor"]["NetworkID"] == net_tor_id)
and (container.attrs["Config"]["User"] == "tor")
]
ip_addrs = [container.attrs['NetworkSettings']['Networks']["net_tor"]["IPAddress"]
for container in containers]
return ip_addrs