bundles/pppd: fix KeyError in restart-pppoe-if-no-public-ip
All checks were successful
bundlewrap/pipeline/head This commit looks good
All checks were successful
bundlewrap/pipeline/head This commit looks good
This commit is contained in:
parent
3a7d612c7a
commit
af6b16cc35
1 changed files with 7 additions and 2 deletions
|
@ -26,13 +26,18 @@ for i in netifaces.interfaces():
|
|||
system_has_public_ip = False
|
||||
for iface in ifaces:
|
||||
for type in [netifaces.AF_INET, netifaces.AF_INET6]:
|
||||
for ip in netifaces.ifaddresses(iface)[type]:
|
||||
try:
|
||||
ips = netifaces.ifaddresses(iface)[type]
|
||||
except KeyError:
|
||||
continue
|
||||
|
||||
for ip in ips
|
||||
try:
|
||||
addr = ip_address(ip['addr'])
|
||||
|
||||
if not addr.is_private and not addr.is_loopback:
|
||||
system_has_public_ip = True
|
||||
except:
|
||||
except Exception:
|
||||
# Apparently not an ip
|
||||
pass
|
||||
|
||||
|
|
Loading…
Reference in a new issue