2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-01-16 12:47:50 +00:00

Fix for unexpected entries in /sys/class/net

For example, in a bonding configuration there is a file there, not just
directories with ifindex entries.
This commit is contained in:
Jarrod Johnson 2017-09-05 09:19:15 -04:00
parent 8774ae0305
commit 12cbfff24f

View File

@ -31,6 +31,8 @@ def list_interface_indexes():
# For now be linux specific
try:
for iface in os.listdir('/sys/class/net/'):
if not os.path.exists('/sys/class/net/{0}/ifindex'.format(iface)):
continue
ifile = open('/sys/class/net/{0}/ifindex'.format(iface), 'r')
intidx = int(ifile.read())
ifile.close()