Skip to content

Commit

Permalink
CSI: Fix panic in NodeUnpublishVolume when err is nil (#1331)
Browse files Browse the repository at this point in the history
Signed-off-by: Grant Griffiths <[email protected]>
  • Loading branch information
ggriffiths authored Nov 26, 2019
1 parent d304e97 commit 1b608aa
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions csi/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,14 @@ func (s *OsdCsiServer) NodeUnpublishVolume(
if err == kvdb.ErrNotFound {
logrus.Infof("Volume %s was deleted or cannot be found: %s", req.GetVolumeId(), err.Error())
return &csi.NodeUnpublishVolumeResponse{}, nil
} else if err != nil {
return nil, status.Errorf(codes.NotFound, "Volume id %s not found: %s",
req.GetVolumeId(),
err.Error())
} else {
return nil, status.Errorf(codes.NotFound, "Volume id %s not found: Inspect returned no volumes",
req.GetVolumeId())
}

return nil, status.Errorf(codes.NotFound, "Volume id %s not found: %s",
req.GetVolumeId(),
err.Error())
}
vol := vols[0]

Expand Down

0 comments on commit 1b608aa

Please sign in to comment.