You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Upon reaching end of mib view the code should return the data found so far, but in stead it raises an exception. This happens both in bulkwalk and walk functions. When using SNMP v1 NoSuchObjectError is raised, with SNMP v2 EndOfMibViewError is raised.
The following diff "fixes" the problem for normal walk.
diff --git a/python/nav/Snmp/pynetsnmp.py b/python/nav/Snmp/pynetsnmp.py
index ef64c1150..9c1045111 100644
--- a/python/nav/Snmp/pynetsnmp.py
+++ b/python/nav/Snmp/pynetsnmp.py
@@ -171,7 +171,10 @@ class Snmp(object):
current_oid = root_oid
while 1:
- response = self.handle.sgetnext(current_oid)
+ try:
+ response = self.handle.sgetnext(current_oid)
+ except (EndOfMibViewError, NoSuchObjectError):
+ break
if response is None:
break
response_oid, value = list(response.items())[0]
Assessing the correctness of this change and making a matching fix for bulkwalk needs to be done by someone else
The text was updated successfully, but these errors were encountered:
Using the snmpsim fixture, it should be trivial to at least produce an integration test that reproduces this bug in an automated fashion. That would be the first step in actually implementing the proposed fix.
Upon reaching end of mib view the code should return the data found so far, but in stead it raises an exception. This happens both in bulkwalk and walk functions. When using SNMP v1 NoSuchObjectError is raised, with SNMP v2 EndOfMibViewError is raised.
The following diff "fixes" the problem for normal walk.
Assessing the correctness of this change and making a matching fix for bulkwalk needs to be done by someone else
The text was updated successfully, but these errors were encountered: