Skip to content

Commit

Permalink
fix bug, last error was shadowed by updateConditions result
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Shitrit <mshitrit@redhat.com>
  • Loading branch information
mshitrit committed Feb 4, 2024
1 parent 796fef2 commit 2e2fbbb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions controllers/selfnoderemediation_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,14 +216,14 @@ func (r *SelfNodeRemediationReconciler) Reconcile(ctx context.Context, req ctrl.
if err != nil {
if apiErrors.IsNotFound(err) {
r.logger.Info("couldn't find node matching remediation", "node name", snr.Name)
if err = r.updateConditions(remediationSkippedNodeNotFound, snr); err != nil {
return ctrl.Result{}, err
if updateErr := r.updateConditions(remediationSkippedNodeNotFound, snr); updateErr != nil {
return ctrl.Result{}, updateErr
}
events.NormalEvent(r.Recorder, snr, eventReasonRemediationStopped, "couldn't find node matching remediation")
return ctrl.Result{}, r.updateSnrStatusLastError(snr, err)
} else {
r.logger.Error(err, "failed to get node", "node name", snr.Name)
}
r.logger.Error(err, "failed to get node", "node name", snr.Name)
return ctrl.Result{}, err
return ctrl.Result{}, r.updateSnrStatusLastError(snr, err)
}

if node.Labels[excludeRemediationLabel] == "true" {
Expand Down

0 comments on commit 2e2fbbb

Please sign in to comment.