snmp: make oid value retrieval more solid
There's no need to try to convert before ignoring. Change-Id: Ie9dcb63c43e7d69ce25aff62a2575b89f26ffca5
This commit is contained in:
parent
500e34019f
commit
7de90448e6
|
@ -195,14 +195,12 @@ class SNMPInspector(base.Inspector):
|
|||
def get_oid_value(oid_cache, oid_def, suffix='', host=None):
|
||||
oid, converter = oid_def
|
||||
value = oid_cache[oid + suffix]
|
||||
if isinstance(value, rfc1905.NoSuchObject):
|
||||
LOG.debug("OID %s%s has no value" % (
|
||||
oid, " on %s" % host.hostname if host else ""))
|
||||
return None
|
||||
if converter:
|
||||
try:
|
||||
value = converter(value)
|
||||
except ValueError:
|
||||
if isinstance(value, rfc1905.NoSuchObject):
|
||||
LOG.debug("OID %s%s has no value" % (
|
||||
oid, " on %s" % host.hostname if host else ""))
|
||||
return None
|
||||
value = converter(value)
|
||||
return value
|
||||
|
||||
@classmethod
|
||||
|
|
Loading…
Reference in New Issue