From 06159c4e1c97dad6a5f3af455baee3464e5c07ac Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 2 Apr 2019 11:26:01 -0400 Subject: [PATCH] Fix fallbackdata Fallbackdata was actually being preferred rather than a last resort. Fix by changing to a more usual return scheme. Change-Id: I098dfc424c173c87c24a712efdebefb46f724473 --- pyghmi/ipmi/command.py | 7 +++---- pyghmi/ipmi/oem/generic.py | 2 +- pyghmi/ipmi/oem/lenovo/imm.py | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pyghmi/ipmi/command.py b/pyghmi/ipmi/command.py index 464dd936..e71a41f9 100644 --- a/pyghmi/ipmi/command.py +++ b/pyghmi/ipmi/command.py @@ -706,16 +706,15 @@ class Command(object): fallbackreadings = [] try: self.oem_init() - self._oem.get_health(summary) + fallbackreadings = self._oem.get_health(summary) for reading in self.get_sensor_data(): if reading.health != const.Health.Ok: summary['health'] |= reading.health summary['badreadings'].append(reading) except exc.BypassGenericBehavior: pass - except exc.FallbackData as fd: - if not summary['badreadings']: - summary['badreadings'] = fd.fallbackdata + if not summary['badreadings']: + summary['badreadings'] = fallbackreadings return summary def get_sensor_reading(self, sensorname): diff --git a/pyghmi/ipmi/oem/generic.py b/pyghmi/ipmi/oem/generic.py index 43f7e7d5..827d2969 100644 --- a/pyghmi/ipmi/oem/generic.py +++ b/pyghmi/ipmi/oem/generic.py @@ -302,7 +302,7 @@ class OEMHandler(object): :param summary: The health summary as prepared by the generic function :return: Nothing, modifies the summary object """ - return + return [] def set_hostname(self, hostname): """OEM specific hook to specify name information diff --git a/pyghmi/ipmi/oem/lenovo/imm.py b/pyghmi/ipmi/oem/lenovo/imm.py index 1a23c6e2..0b553a59 100644 --- a/pyghmi/ipmi/oem/lenovo/imm.py +++ b/pyghmi/ipmi/oem/lenovo/imm.py @@ -1733,7 +1733,7 @@ class XCCClient(IMMClient): 'health': pygconst.Health.Warning, 'type': 'LED', }, '')) - raise pygexc.FallbackData(fallbackdata) + return fallbackdata # Will use the generic handling for unhealthy systems def get_licenses(self):