Skip to content

Commit

Permalink
FS-1783: Relax errors for missing component status (#116)
Browse files Browse the repository at this point in the history
* relax error and only log

* clean up

* linter issues

* resolved comments

* Replace warn with err

* update log format
  • Loading branch information
sahil311289 authored Nov 14, 2024
1 parent 49e5611 commit 8998df5
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions internal/inventory/device_components.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,21 +238,26 @@ func componentsFromDatabase(ctx context.Context, exec boil.ContextExecutor,
return nil, errors.Wrap(err, "retrieving "+rec.Name.String+"-"+rec.ID+" firmware"+":"+err.Error())
}

st, err := retrieveComponentStatusVA(ctx, exec, rec.ID, getStatusNamespace(inband))
switch err {
case nil, sql.ErrNoRows:
default:
return nil, errors.Wrap(err, "retrieving "+rec.Name.String+"-"+rec.ID+" status"+":"+err.Error())
}
comp := &rivets.Component{
Name: rec.Name.String,
Vendor: rec.Vendor.String,
Model: rec.Model.String,
Serial: rec.Serial.String,
Firmware: fw,
Status: st,
Attributes: attr,
}

st, err := retrieveComponentStatusVA(ctx, exec, rec.ID, getStatusNamespace(inband))
if err != nil {
// Relax error
zap.L().With(
zap.Error(err),
zap.String("rec.ID", rec.ID),
zap.String("rec.Name", rec.Name.String),
).Warn("error retrieving status versioned attribute")
} else {
comp.Status = st
}
comps = append(comps, comp)
}

Expand Down

0 comments on commit 8998df5

Please sign in to comment.