Skip to content

Commit

Permalink
Set uuid to nil if failed to parse
Browse files Browse the repository at this point in the history
  • Loading branch information
ClayBenson94 committed May 23, 2024
1 parent a8ed830 commit f057aff
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/cedar/core/system_summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,11 @@ func (c *Client) GetSystemSummary(ctx context.Context, opts ...systemSummaryPara
for _, sys := range resp.Payload.SystemSummary {
if sys.IctObjectID != nil {
uuid, uErr := uuid.Parse(sys.UUID)
uuidString := zero.StringFrom(uuid.String())
// errors in parsing shouldn't stop the process, but we should log when it happens
if uErr != nil {
appcontext.ZLogger(ctx).Warn("failed to parse System UUID", zap.String("cedarUUID", sys.UUID))
uuidString = zero.StringFromPtr(nil)
}

cedarSys := &models.CedarSystem{
Expand All @@ -86,7 +88,7 @@ func (c *Client) GetSystemSummary(ctx context.Context, opts ...systemSummaryPara
SystemMaintainerOrg: zero.StringFrom(sys.SystemMaintainerOrg),
SystemMaintainerOrgComp: zero.StringFrom(sys.SystemMaintainerOrgComp),
ID: zero.StringFromPtr(sys.IctObjectID),
UUID: zero.StringFrom(uuid.String()),
UUID: uuidString,
}
retVal = append(retVal, cedarSys)
}
Expand Down

0 comments on commit f057aff

Please sign in to comment.