mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Handle 'No more variables left in this MIB View ' in snmp_facts (#613)
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
This commit is contained in:
parent
7ac467a359
commit
d7aabcceed
2 changed files with 5 additions and 0 deletions
2
changelogs/fragments/613-snmp_facts-EndOfMibView.yml
Normal file
2
changelogs/fragments/613-snmp_facts-EndOfMibView.yml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- snmp_facts - skip ``EndOfMibView`` values (https://github.com/ansible/ansible/issues/49044).
|
|
@ -173,6 +173,7 @@ from collections import defaultdict
|
||||||
PYSNMP_IMP_ERR = None
|
PYSNMP_IMP_ERR = None
|
||||||
try:
|
try:
|
||||||
from pysnmp.entity.rfc3413.oneliner import cmdgen
|
from pysnmp.entity.rfc3413.oneliner import cmdgen
|
||||||
|
from pysnmp.proto.rfc1905 import EndOfMibView
|
||||||
has_pysnmp = True
|
has_pysnmp = True
|
||||||
except Exception:
|
except Exception:
|
||||||
PYSNMP_IMP_ERR = traceback.format_exc()
|
PYSNMP_IMP_ERR = traceback.format_exc()
|
||||||
|
@ -393,6 +394,8 @@ def main():
|
||||||
|
|
||||||
for varBinds in varTable:
|
for varBinds in varTable:
|
||||||
for oid, val in varBinds:
|
for oid, val in varBinds:
|
||||||
|
if isinstance(val, EndOfMibView):
|
||||||
|
continue
|
||||||
current_oid = oid.prettyPrint()
|
current_oid = oid.prettyPrint()
|
||||||
current_val = val.prettyPrint()
|
current_val = val.prettyPrint()
|
||||||
if v.ifIndex in current_oid:
|
if v.ifIndex in current_oid:
|
||||||
|
|
Loading…
Reference in a new issue