From e7dc28fe9a291c454d55d652a26a8e55c862877e Mon Sep 17 00:00:00 2001 From: Andrey Vertiprahov Date: Wed, 22 Sep 2021 20:04:35 +0500 Subject: [PATCH] Qtech.BFC_PBIC_S.get_interface_status_ex. Fix reference before assignment. --- .../Qtech/BFC_PBIC_S/get_interface_status_ex.py | 11 ++++++----- sa/profiles/Qtech/BFC_PBIC_S/get_inventory.py | 3 ++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/sa/profiles/Qtech/BFC_PBIC_S/get_interface_status_ex.py b/sa/profiles/Qtech/BFC_PBIC_S/get_interface_status_ex.py index a15992b100..94e178f8c9 100644 --- a/sa/profiles/Qtech/BFC_PBIC_S/get_interface_status_ex.py +++ b/sa/profiles/Qtech/BFC_PBIC_S/get_interface_status_ex.py @@ -27,15 +27,17 @@ class Script(BaseScript): s_status = False battery = False descr = self.snmp.get("1.3.6.1.3.55.1.3.1.2.%s" % value) - if descr in [0, 3]: + try: status = self.snmp.get("1.3.6.1.3.55.1.3.1.4.%s" % value) + except self.snmp.SNMPError: + status = None + if descr in [0, 3]: invert = self.snmp.get("1.3.6.1.3.55.1.3.1.3.%s" % value) if invert == 0 and status == 0: s_status = True elif invert == 1 and status == 1: s_status = True elif descr in [9, 10]: - status = self.snmp.get("1.3.6.1.3.55.1.3.1.4.%s" % value) invert = self.snmp.get("1.3.6.1.3.55.1.3.1.3.%s" % value) if descr == 9: if invert == 0 and status == 0: @@ -55,9 +57,8 @@ class Script(BaseScript): s_status = True elif battery and invert == 1 and status == 1: s_status = True - else: - if status > 0: - s_status = True + elif status: + s_status = True result += [ { "interface": "%s/%s" % (descr, value + 1) if descr == 0 else descr, diff --git a/sa/profiles/Qtech/BFC_PBIC_S/get_inventory.py b/sa/profiles/Qtech/BFC_PBIC_S/get_inventory.py index c2e33e8372..a8ebbdfdf9 100644 --- a/sa/profiles/Qtech/BFC_PBIC_S/get_inventory.py +++ b/sa/profiles/Qtech/BFC_PBIC_S/get_inventory.py @@ -34,8 +34,9 @@ class Script(BaseScript): :return: """ temp = self.snmp.get("1.3.6.1.3.55.1.2.1.0") + r = [] if temp: - r = [ + r += [ # temp { "name": "temp_out", -- GitLab