cleanup: return error type in rbdGetDeviceList()

Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos 2020-12-08 15:05:59 +01:00 committed by mergify[bot]
parent 4dde3fc9e0
commit 7eae69f10c

View File

@ -87,7 +87,7 @@ func rbdGetDeviceList(ctx context.Context, accessType string) ([]rbdDeviceInfo,
stdout, _, err := util.ExecCommand(ctx, rbd, "device", "list", "--format="+"json", "--device-type", accessType)
if err != nil {
return nil, fmt.Errorf("error getting device list from rbd for devices of type (%s): (%v)", accessType, err)
return nil, fmt.Errorf("error getting device list from rbd for devices of type (%s): %w", accessType, err)
}
if accessType == accessTypeKRbd {
@ -96,7 +96,7 @@ func rbdGetDeviceList(ctx context.Context, accessType string) ([]rbdDeviceInfo,
err = json.Unmarshal([]byte(stdout), &nbdDeviceList)
}
if err != nil {
return nil, fmt.Errorf("error to parse JSON output of device list for devices of type (%s): (%v)", accessType, err)
return nil, fmt.Errorf("error to parse JSON output of device list for devices of type (%s): %w", accessType, err)
}
// convert output to a rbdDeviceInfo list for consumers