From 45dc3bad830bfe83b147cebbad3b133960dc0d05 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 10 May 2022 08:08:30 -0400 Subject: [PATCH] Ignore stub log entries Some BMCs implement entry logs that are not actionable. Trim those out to avoid empty data for a user to scratch their head at. Change-Id: I05ea62cdd3a56dfdeea4080774ec5a67a651824f --- pyghmi/redfish/command.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pyghmi/redfish/command.py b/pyghmi/redfish/command.py index 50285ad4..da168a97 100644 --- a/pyghmi/redfish/command.py +++ b/pyghmi/redfish/command.py @@ -1375,6 +1375,10 @@ class Command(object): entries = self._do_web_request(entriesurl, cache=False) newloginfo = self._do_web_request(lurl, cache=False) for log in entries.get('Members', []): + if ('Created' not in log and 'Message' not in log + and 'Severity' not in log): + # without any data, this log entry isn't actionable + continue record = {} record['log_id'] = logid parsedtime = parse_time(log.get('Created', '')) @@ -1386,7 +1390,7 @@ class Command(object): record['timestamp'] = log.get('Created', '') record['message'] = log.get('Message', None) record['severity'] = _healthmap.get( - entries.get('Severity', 'Warning'), const.Health.Critical) + log.get('Severity', 'Warning'), const.Health.Ok) yield record def get_sensor_descriptions(self):