mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-12 17:30:19 +00:00
cleanup: use errors.As() in rbd.rbdStatus()
See-also: https://github.com/golang/go/wiki/ErrorValueFAQ#how-should-i-change-my-error-handling-code-to-work-with-the-new-features Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
parent
f93730dee7
commit
7126e92b4f
@ -288,8 +288,9 @@ func rbdStatus(ctx context.Context, pOpts *rbdVolume, cr *util.Credentials) (boo
|
|||||||
cmd, err := execCommand("rbd", args)
|
cmd, err := execCommand("rbd", args)
|
||||||
output = string(cmd)
|
output = string(cmd)
|
||||||
|
|
||||||
if err, ok := err.(*exec.Error); ok {
|
var ee *exec.Error
|
||||||
if errors.Is(err.Err, exec.ErrNotFound) {
|
if errors.As(err, &ee) {
|
||||||
|
if errors.Is(ee, exec.ErrNotFound) {
|
||||||
klog.Errorf(util.Log(ctx, "rbd cmd not found"))
|
klog.Errorf(util.Log(ctx, "rbd cmd not found"))
|
||||||
// fail fast if command not found
|
// fail fast if command not found
|
||||||
return false, output, err
|
return false, output, err
|
||||||
|
Loading…
Reference in New Issue
Block a user