2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-27 19:37:44 +00:00

Fix fallbackdata

Fallbackdata was actually being preferred rather than a
last resort.  Fix by changing to a more usual return
scheme.

Change-Id: I098dfc424c173c87c24a712efdebefb46f724473
This commit is contained in:
Jarrod Johnson 2019-04-02 11:26:01 -04:00
parent 191acd0758
commit 06159c4e1c
3 changed files with 5 additions and 6 deletions

View File

@ -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):

View File

@ -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

View File

@ -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):