Improve log messages for failed step replies
@@ -1873,14 +1873,15 @@ func (b *bareMetalInventory) PostStepReply(ctx context.Context, params installer
//check the output exit code
if params.Reply.ExitCode != 0 {
- err = errors.Errorf(msg)
+ err = errors.New(msg)
log.WithError(err).Errorf("Exit code is <%d> ", params.Reply.ExitCode)
handlingError := b.handleReplyError(params, ctx, &host)
if handlingError != nil {
log.WithError(handlingError).Errorf("Failed handling reply error for host <%s> cluster <%s>", params.HostID, params.ClusterID)
}
+ // Since the assisted agent sent the message to the assisted service, no reason to send the same message back. It will cause a log spam
return installer.NewPostStepReplyBadRequest().
- WithPayload(common.GenerateError(http.StatusBadRequest, err))
+ WithPayload(common.GenerateError(http.StatusBadRequest, errors.Errorf("Step <%s> terminated with non zero exit-code <%d>", params.Reply.StepID, params.Reply.ExitCode)))
}
log.Infof(msg)
