Skip to content

Commit 56ad1cb

Browse files
committed
vz: change linuxBootLoader() to return error, then explicitly ignores the error on caller.
Signed-off-by: Norio Nomura <norio.nomura@gmail.com> vz: add comment to `bootLoader()` Signed-off-by: Norio Nomura <norio.nomura@gmail.com>
1 parent f5915cc commit 56ad1cb

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pkg/vz/vm_darwin.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -682,8 +682,9 @@ func getMachineIdentifier(driver *driver.BaseDriver) (*vz.GenericMachineIdentifi
682682
}
683683

684684
func bootLoader(driver *driver.BaseDriver) (vz.BootLoader, error) {
685-
if linuxBootLoder, err := linuxBootLoader(driver); linuxBootLoder != nil {
686-
return linuxBootLoder, err
685+
// ignore the error it might be a non-existing kernel file
686+
if linuxBootLoder, _ := linuxBootLoader(driver); linuxBootLoder != nil {
687+
return linuxBootLoder, nil
687688
}
688689

689690
efiVariableStore, err := getEFI(driver)
@@ -700,7 +701,7 @@ func linuxBootLoader(driver *driver.BaseDriver) (*vz.LinuxBootLoader, error) {
700701
initrd := filepath.Join(driver.Instance.Dir, filenames.Initrd)
701702
if _, err := os.Stat(kernel); err != nil {
702703
logrus.Debugf("Kernel file %q not found", kernel)
703-
return nil, nil
704+
return nil, err
704705
}
705706
var opt []vz.LinuxBootLoaderOption
706707
if b, err := os.ReadFile(kernelCmdline); err == nil {

0 commit comments

Comments
 (0)