Merge pull request #87713 from kkmsft/filepath-fixes-windows

Move 'path' package usage to 'path/filepath'.
This commit is contained in:
Kubernetes Prow Robot 2020-02-03 17:07:25 -08:00 committed by GitHub
commit 76c89645c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 5 deletions

View File

@ -22,7 +22,6 @@ import (
"errors"
"fmt"
"os"
"path"
"path/filepath"
"strconv"
@ -432,7 +431,7 @@ func removeMountDir(plug *csiPlugin, mountPath string) error {
return errors.New(log("failed to remove dir [%s]: %v", mountPath, err))
}
// remove volume data file as well
volPath := path.Dir(mountPath)
volPath := filepath.Dir(mountPath)
dataFile := filepath.Join(volPath, volDataFileName)
klog.V(4).Info(log("also deleting volume info data file [%s]", dataFile))
if err := os.Remove(dataFile); err != nil && !os.IsNotExist(err) {

View File

@ -20,7 +20,7 @@ import (
"errors"
"fmt"
"os"
"path"
"path/filepath"
"strings"
"time"
@ -387,7 +387,7 @@ func (p *csiPlugin) NewMounter(
// Save volume info in pod dir
dir := mounter.GetPath()
dataDir := path.Dir(dir) // dropoff /mount at end
dataDir := filepath.Dir(dir) // dropoff /mount at end
if err := os.MkdirAll(dataDir, 0750); err != nil {
return nil, errors.New(log("failed to create dir %#v: %v", dataDir, err))
@ -438,7 +438,7 @@ func (p *csiPlugin) NewUnmounter(specName string, podUID types.UID) (volume.Unmo
// load volume info from file
dir := unmounter.GetPath()
dataDir := path.Dir(dir) // dropoff /mount at end
dataDir := filepath.Dir(dir) // dropoff /mount at end
data, err := loadVolumeData(dataDir, volDataFileName)
if err != nil {
return nil, errors.New(log("unmounter failed to load volume data file [%s]: %v", dir, err))