Make get_snmp_data more robust (#6798)

pull/6810/head
tantecky 2017-03-27 12:22:59 +02:00 committed by Pascal Vizeli
parent be04ef7be1
commit a70af62e60
1 changed files with 4 additions and 1 deletions

View File

@ -125,7 +125,10 @@ class SnmpScanner(DeviceScanner):
for resrow in restable: for resrow in restable:
for _, val in resrow: for _, val in resrow:
mac = binascii.hexlify(val.asOctets()).decode('utf-8') try:
mac = binascii.hexlify(val.asOctets()).decode('utf-8')
except AttributeError:
continue
_LOGGER.debug("Found MAC %s", mac) _LOGGER.debug("Found MAC %s", mac)
mac = ':'.join([mac[i:i+2] for i in range(0, len(mac), 2)]) mac = ':'.join([mac[i:i+2] for i in range(0, len(mac), 2)])
devices.append({'mac': mac}) devices.append({'mac': mac})