Skip to content

Commit

Permalink
osd: do not hide errors
Browse files Browse the repository at this point in the history
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 <seb@redhat.com>
  • Loading branch information
leseb committed Oct 7, 2021
1 parent 8e1a6ef commit 4471f3a
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions pkg/util/sys/device.go
Expand Up @@ -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
}
Expand Down

0 comments on commit 4471f3a

Please sign in to comment.