mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-22 17:43:14 +00:00
Non-linux fallback for list_interface_indexes()
When errors suggest we are not in linux, make a best effort using netifaces.
This commit is contained in:
parent
1116fed1e7
commit
fa6650a072
@ -37,7 +37,14 @@ def list_interface_indexes():
|
||||
yield intidx
|
||||
except (IOError, OSError):
|
||||
# Probably situation is non-Linux, just do limited support for
|
||||
# such platforms until other people come alonge
|
||||
# such platforms until other people come along
|
||||
for iface in netifaces.interfaces():
|
||||
addrinfo = netifaces.ifaddresses(iface).get(socket.AF_INET6, [])
|
||||
for addr in addrinfo:
|
||||
v6addr = addr.get('addr', '').partition('%')[2]
|
||||
if v6addr:
|
||||
yield(int(v6addr))
|
||||
break
|
||||
return
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user