diff --git a/changelogs/fragments/613-snmp_facts-EndOfMibView.yml b/changelogs/fragments/613-snmp_facts-EndOfMibView.yml new file mode 100644 index 0000000000..acf4c8bd40 --- /dev/null +++ b/changelogs/fragments/613-snmp_facts-EndOfMibView.yml @@ -0,0 +1,2 @@ +bugfixes: + - snmp_facts - skip ``EndOfMibView`` values (https://github.com/ansible/ansible/issues/49044). diff --git a/plugins/modules/net_tools/snmp_facts.py b/plugins/modules/net_tools/snmp_facts.py index 96a7a554d8..e61b468631 100644 --- a/plugins/modules/net_tools/snmp_facts.py +++ b/plugins/modules/net_tools/snmp_facts.py @@ -173,6 +173,7 @@ from collections import defaultdict PYSNMP_IMP_ERR = None try: from pysnmp.entity.rfc3413.oneliner import cmdgen + from pysnmp.proto.rfc1905 import EndOfMibView has_pysnmp = True except Exception: PYSNMP_IMP_ERR = traceback.format_exc() @@ -393,6 +394,8 @@ def main(): for varBinds in varTable: for oid, val in varBinds: + if isinstance(val, EndOfMibView): + continue current_oid = oid.prettyPrint() current_val = val.prettyPrint() if v.ifIndex in current_oid: