2
0
mirror of https://opendev.org/x/pyghmi synced 2025-02-10 15:54:29 +00:00

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
This commit is contained in:
Jarrod Johnson 2022-05-10 08:08:30 -04:00
parent 68cca2e34f
commit 45dc3bad83

View File

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