From 47834ea32998b2177cea9bc8eb81eba3a5614672 Mon Sep 17 00:00:00 2001 From: Jack Ding Date: Fri, 17 Feb 2023 09:48:16 -0500 Subject: [PATCH] Fix Redfish Event parsing for Oem field Signed-off-by: Jack Ding --- pkg/event/redfish/event_ce_test.go | 1 + pkg/event/redfish/event_marshal.go | 1 + pkg/event/redfish/event_marshal_test.go | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/pkg/event/redfish/event_ce_test.go b/pkg/event/redfish/event_ce_test.go index 3ac86d2..ab5d53a 100644 --- a/pkg/event/redfish/event_ce_test.go +++ b/pkg/event/redfish/event_ce_test.go @@ -63,6 +63,7 @@ var ( Events: []redfish.EventRecord{EVENT_RECORD_TMP0100}, ID: "5e004f5a-e3d1-11eb-ae9c-3448edf18a38", Name: "Event Array", + Oem: []byte(`{"Dell":{"@odata.type":"#DellEvent.v1_0_0.DellEvent","ServerHostname":""}}`), } ) diff --git a/pkg/event/redfish/event_marshal.go b/pkg/event/redfish/event_marshal.go index a571ea8..1c1b2a3 100644 --- a/pkg/event/redfish/event_marshal.go +++ b/pkg/event/redfish/event_marshal.go @@ -59,6 +59,7 @@ func WriteJSONEvent(in *Event, writer io.Writer, stream *jsoniter.Stream) error if err != nil { return fmt.Errorf("error writing Oem: %w", err) } + stream.WriteMore() } if data.OdataType != "" { stream.WriteObjectField("@odata.type") diff --git a/pkg/event/redfish/event_marshal_test.go b/pkg/event/redfish/event_marshal_test.go index dd321ca..b09ae2d 100644 --- a/pkg/event/redfish/event_marshal_test.go +++ b/pkg/event/redfish/event_marshal_test.go @@ -51,6 +51,12 @@ var ( }, "Id": "5e004f5a-e3d1-11eb-ae9c-3448edf18a38", "Name": "Event Array", + "Oem": map[string]interface{}{ + "Dell": map[string]interface{}{ + "@odata.type": "#DellEvent.v1_0_0.DellEvent", + "ServerHostname": "", + }, + }, } )