2
0
mirror of https://opendev.org/x/pyghmi synced 2025-08-22 19:10:19 +00:00

Only conditionally delete fields from event

If some events (for example, OEM events) are encountered,
the deleted fields won't exist in the first place.  Avoid
KeyErrors by checking before deleting.

Change-Id: I91ca73f4288c7b877589e766c8ce1ea1166e0d37
This commit is contained in:
Jarrod Johnson
2015-05-19 15:38:56 -04:00
parent 329e9fc188
commit e019fb4c88

View File

@@ -454,8 +454,10 @@ class EventHandler(object):
# is wholly left up to the OEM layer, using the OEM ID of the BMC
event['oemdata'] = selentry[3:]
self._ipmicmd._oem.process_event(event)
del event['event_type_byte']
del event['event_data_bytes']
if 'event_type_byte' in event:
del event['event_type_byte']
if 'event_data_bytes' in event:
del event['event_data_bytes']
return event
def _fetch_entries(self, ipmicmd, startat, targetlist, rsvid=0):