Skip to content

Commit

Permalink
Fix Redfish Event parsing for Oem field
Browse files Browse the repository at this point in the history
Signed-off-by: Jack Ding <jackding@gmail.com>
  • Loading branch information
jzding committed Feb 17, 2023
1 parent accdb34 commit 47834ea
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/event/redfish/event_ce_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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":""}}`),
}
)

Expand Down
1 change: 1 addition & 0 deletions pkg/event/redfish/event_marshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
6 changes: 6 additions & 0 deletions pkg/event/redfish/event_marshal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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": "",
},
},
}
)

Expand Down

0 comments on commit 47834ea

Please sign in to comment.