Skip to content

Commit 4f9e3f6

Browse files
authored
Merge pull request #526 from tam7t/tam7t/unmount-cleanup
cleanup: remove windows file deletion on unmount
2 parents c39e0a8 + 7337954 commit 4f9e3f6

File tree

1 file changed

+0
-14
lines changed

1 file changed

+0
-14
lines changed

pkg/secrets-store/nodeserver.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,9 @@ import (
2121
"errors"
2222
"fmt"
2323
"os"
24-
"runtime"
2524

2625
csicommon "sigs.k8s.io/secrets-store-csi-driver/pkg/csi-common"
2726
internalerrors "sigs.k8s.io/secrets-store-csi-driver/pkg/errors"
28-
"sigs.k8s.io/secrets-store-csi-driver/pkg/util/fileutil"
2927

3028
"github.com/container-storage-interface/spec/lib/go/csi"
3129
"golang.org/x/net/context"
@@ -222,23 +220,11 @@ func (ns *nodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpu
222220
return nil, status.Error(codes.InvalidArgument, "Target path missing in request")
223221
}
224222
targetPath := req.GetTargetPath()
225-
// Assume no mounted files if GetMountedFiles fails.
226-
files, _ := fileutil.GetMountedFiles(targetPath)
227223

228224
if isMockTargetPath(targetPath) {
229225
return &csi.NodeUnpublishVolumeResponse{}, nil
230226
}
231227

232-
// remove files
233-
if runtime.GOOS == "windows" {
234-
for _, file := range files {
235-
err = os.RemoveAll(file)
236-
if err != nil {
237-
klog.ErrorS(err, "failed to remove file from target path", "file", file)
238-
return nil, status.Error(codes.Internal, err.Error())
239-
}
240-
}
241-
}
242228
err = mount.CleanupMountPoint(targetPath, ns.mounter, false)
243229
if err != nil && !os.IsNotExist(err) {
244230
klog.ErrorS(err, "failed to clean and unmount target path", "targetPath", targetPath)

0 commit comments

Comments
 (0)