mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-23 21:40:20 +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)
|
||||
output = string(cmd)
|
||||
|
||||
if err, ok := err.(*exec.Error); ok {
|
||||
if errors.Is(err.Err, exec.ErrNotFound) {
|
||||
var ee *exec.Error
|
||||
if errors.As(err, &ee) {
|
||||
if errors.Is(ee, exec.ErrNotFound) {
|
||||
klog.Errorf(util.Log(ctx, "rbd cmd not found"))
|
||||
// fail fast if command not found
|
||||
return false, output, err
|
||||
|
Loading…
Reference in New Issue
Block a user