From 4471f3a92ef8ec6c28f433bd2f108d81c5e1b860 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Thu, 7 Oct 2021 17:38:03 +0200 Subject: [PATCH] osd: do not hide errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous exit 32 check for loop device is 5 years old. Also, if the device cannot be read it will be skipped anyway so let's report the error and not hide it. Signed-off-by: Sébastien Han --- pkg/util/sys/device.go | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/pkg/util/sys/device.go b/pkg/util/sys/device.go index 873633cd6807..f664de46b468 100644 --- a/pkg/util/sys/device.go +++ b/pkg/util/sys/device.go @@ -209,18 +209,6 @@ func GetDevicePropertiesFromPath(devicePath string, executor exec.Executor) (map output, err := executor.ExecuteCommandWithOutput("lsblk", devicePath, "--bytes", "--nodeps", "--pairs", "--paths", "--output", "SIZE,ROTA,RO,TYPE,PKNAME,NAME,KNAME") if err != nil { - // The "not a block device" error also returns code 32 so the ExitStatus() check hides this error - if strings.Contains(output, "not a block device") { - return nil, err - } - - // try to get more information about the command error - if code, ok := exec.ExitStatus(err); ok && code == 32 { - // certain device types (such as loop) return exit status 32 when probed further, - // ignore and continue without logging - return map[string]string{}, nil - } - logger.Errorf("failed to execute lsblk. output: %s", output) return nil, err }