Skip to content

Commit b12b628

Browse files
cfergeaugbraad
authored andcommitted
Issue #406 preflight: Add missing error handling
This is related to #406
1 parent 61a02ad commit b12b628

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

pkg/crc/preflight/preflight_checks_linux.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,19 @@ func checkMachineDriverLibvirtInstalled() (bool, error) {
224224
if err != nil {
225225
return false, err
226226
}
227-
fi, _ := os.Stat(path)
227+
fi, err := os.Stat(path)
228+
if err != nil {
229+
return false, err
230+
}
228231
// Check if permissions are correct
229232
if fi.Mode()&0011 == 0 {
230233
return false, errors.New("crc-driver-libvirt does not have correct permissions")
231234
}
232235
// Check the version of driver if it matches to supported one
233-
stdOut, stdErr, _ := crcos.RunWithDefaultLocale(path, "version")
236+
stdOut, stdErr, err := crcos.RunWithDefaultLocale(path, "version")
237+
if err != nil {
238+
return false, err
239+
}
234240
if !strings.Contains(stdOut, libvirtDriverVersion) {
235241
return false, fmt.Errorf("crc-driver-libvirt does not have right version \n Required: %s \n Got: %s use 'crc setup' command.\n %v\n", libvirtDriverVersion, stdOut, stdErr)
236242
}

0 commit comments

Comments
 (0)