fix(crash): reuse the err variable (#353)

The error variable is being redeclared, so this is not
accessible outside of the loop and the provisioner is crashing
while return in case of error as it tries to access err.Error
and err is nil outside of the loop.

Signed-off-by: Pawan <pawan@mayadata.io>
This commit is contained in:
Pawan Prakash Sharma 2021-06-25 11:44:24 +05:30 committed by GitHub
parent 273bf148d4
commit 9b907fa884
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -290,7 +290,8 @@ func CreateZFSVolume(ctx context.Context, req *csi.CreateVolumeRequest) (string,
// try volume creation sequentially on all nodes
for _, node := range prfList {
nodeid, err := zfs.GetNodeID(node)
var nodeid string
nodeid, err = zfs.GetNodeID(node)
if err != nil {
continue
}