2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-15 04:07:48 +00:00

Provide get_event_log even when time unparseable

If a format that is not supported appears, at least
pass through the value.

Change-Id: I96d2ef6cb36bdfe9d993a3c046105589cd101000
This commit is contained in:
Jarrod Johnson 2019-07-25 12:43:45 -04:00
parent 142ff10cb2
commit a578d783f7

View File

@ -1332,8 +1332,14 @@ class Command(object):
newloginfo = self._do_web_request(lurl, cache=False)
for log in entries.get('Members', []):
record = {}
entime = parse_time(log.get('Created', '')) + correction
entime = entime.astimezone(ltz)
parsedtime = parse_time(log.get('Created', ''))
if parsedtime:
entime = parsedtime + correction
entime = entime.astimezone(ltz)
entime = entime.strftime('%Y-%m-%dT%H:%M:%S')
else:
record['timestamp'] = log.get('Created', '')
record['timestamp'] = entime.strftime('%Y-%m-%dT%H:%M:%S')
record['message'] = log.get('Message', None)
record['severity'] = _healthmap.get(