Skip to content

Commit 60c84b7

Browse files
committed
preinstall: Return warnings as errors if RunChecks is already going to return an error
If RunChecks returns one or more errors, any warnings that have been collected and which would normally be returned via the CheckResults structure will be discarded. In the case where RunChecks is already going to return one or more errors, it should also return any warnings that occurred as errors as well.
1 parent c9da599 commit 60c84b7

File tree

3 files changed

+446
-75
lines changed

3 files changed

+446
-75
lines changed

efi/preinstall/checks.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,9 @@ func RunChecks(ctx context.Context, flags CheckFlags, loadedImages []secboot_efi
485485
}
486486

487487
if len(deferredErrs) > 0 {
488+
// If we are returning one or more error, then append any warnings
489+
// to the returned errors as well.
490+
deferredErrs = append(deferredErrs, warnings...)
488491
return nil, joinErrors(deferredErrs...)
489492
}
490493

0 commit comments

Comments
 (0)