Skip to content

Commit a7dd63e

Browse files
committed
Fix HFC error handling in actionPreparing
When a provisioning error happens and firmware updates are involved, we should only set the Status Updates of the HFC to nil if they are not nil. Call Status.Update to make sure the HFC object will be updated Signed-off-by: Iury Gregory Melo Ferreira <[email protected]>
1 parent 8d9ac7f commit a7dd63e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

controllers/metal3.io/baremetalhost_controller.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1178,9 +1178,12 @@ func (r *BareMetalHostReconciler) actionPreparing(prov provisioner.Provisioner,
11781178
info.log.Info("handling cleaning error in controller")
11791179
clearHostProvisioningSettings(info.host)
11801180
}
1181-
if hfcDirty {
1181+
if hfcDirty && hfc.Status.Updates != nil {
11821182
info.log.Info("handling cleaning error during firmware update")
11831183
hfc.Status.Updates = nil
1184+
if err := r.Status().Update(info.ctx, hfc); err != nil {
1185+
return actionError{errors.Wrap(err, "failed to update hostfirmwarecomponents status")}
1186+
}
11841187
}
11851188
return recordActionFailure(info, metal3api.PreparationError, provResult.ErrorMessage)
11861189
}

0 commit comments

Comments
 (0)