From d7aabcceedf0c0113cf2761e47ec997ec07a4809 Mon Sep 17 00:00:00 2001 From: ernst-s <17832702+ernst-s@users.noreply.github.com> Date: Tue, 21 Jul 2020 09:10:26 +0200 Subject: [PATCH] Handle 'No more variables left in this MIB View ' in snmp_facts (#613) Co-authored-by: Andrew Klychkov --- changelogs/fragments/613-snmp_facts-EndOfMibView.yml | 2 ++ plugins/modules/net_tools/snmp_facts.py | 3 +++ 2 files changed, 5 insertions(+) create mode 100644 changelogs/fragments/613-snmp_facts-EndOfMibView.yml 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: