mirror of
https://github.com/xcat2/confluent.git
synced 2024-12-25 12:41:39 +00:00
Fix nic index map with bonding
The assumption that /sys/class/net is interfaces is incorrect, when encountering entries that are not interfaces, do not mess up the call.
This commit is contained in:
parent
95466392f9
commit
e583d34555
@ -82,8 +82,11 @@ _idxtoifnamemap = {}
|
||||
def _rebuildidxmap():
|
||||
_idxtoifnamemap.clear()
|
||||
for iname in os.listdir('/sys/class/net'):
|
||||
ci = int(open('/sys/class/net/{0}/ifindex'.format(iname)).read())
|
||||
_idxtoifnamemap[ci] = iname
|
||||
try:
|
||||
ci = int(open('/sys/class/net/{0}/ifindex'.format(iname)).read())
|
||||
_idxtoifnamemap[ci] = iname
|
||||
except Exception: # there may be non interface in /sys/class/net
|
||||
pass
|
||||
|
||||
|
||||
def myiptonets(svrip):
|
||||
|
Loading…
Reference in New Issue
Block a user