[hptools] recherche de mac sans échec

Ignore-this: f21caadc92a30890ad13fc0d55c0f696
mais vu le patch, je me demande si c'est pas une tentative pour planquer
la poussière sous le tapis :p

darcs-hash:20120621092006-28565-91890d316daaac9281903319a9479e71d71afce2.gz
This commit is contained in:
Daniel STAN 2012-06-21 11:20:06 +02:00
parent aaed331b19
commit d72c284c5c

View file

@ -256,11 +256,14 @@ class hpswitch :
# On cherche dans data la bonne adresse MAC
for (onesnmp, onemac) in data.iteritems():
onemac = findall('".*"', onemac)[0][1:-1]
if ' ' not in onemac:
onemac = " ".join("%02x" % ord(digit) for digit in mac)
if onemac.startswith(mac):
return int(onesnmp.split(".")[1])
try:
onemac = findall('".*"', onemac)[0][1:-1]
if ' ' not in onemac:
onemac = " ".join("%02x" % ord(digit) for digit in mac)
if onemac.startswith(mac):
return int(onesnmp.split(".")[1])
except:
pass
# On a rien trouvé
return None