Merge pull request #81204 from codenrhoden/rename-hu-pathexists
Rename HostUtils.ExistsPath to PathExists
This commit is contained in:
@@ -247,8 +247,8 @@ func (hu *FakeHostUtil) MakeFile(pathname string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ExistsPath checks if pathname exists.
|
||||
func (hu *FakeHostUtil) ExistsPath(pathname string) (bool, error) {
|
||||
// PathExists checks if pathname exists.
|
||||
func (hu *FakeHostUtil) PathExists(pathname string) (bool, error) {
|
||||
if _, ok := hu.Filesystem[pathname]; ok {
|
||||
return true, nil
|
||||
}
|
||||
|
@@ -91,8 +91,9 @@ type HostUtils interface {
|
||||
MakeFile(pathname string) error
|
||||
// MakeDir creates a new directory.
|
||||
MakeDir(pathname string) error
|
||||
// PathExists tests if the given path already exists
|
||||
// Error is returned on any other error than "file not found".
|
||||
ExistsPath(pathname string) (bool, error)
|
||||
PathExists(pathname string) (bool, error)
|
||||
// EvalHostSymlinks returns the path name after evaluating symlinks.
|
||||
EvalHostSymlinks(pathname string) (string, error)
|
||||
// GetOwner returns the integer ID for the user and group of the given path
|
||||
|
@@ -28,8 +28,6 @@ import (
|
||||
// called instead of IsLikelyNotMountPoint. IsNotMountPoint is more expensive
|
||||
// but properly handles bind mounts within the same fs.
|
||||
func CleanupMountPoint(mountPath string, mounter Interface, extensiveMountPointCheck bool) error {
|
||||
// mounter.ExistsPath cannot be used because for containerized kubelet, we need to check
|
||||
// the path in the kubelet container, not on the host.
|
||||
pathExists, pathErr := PathExists(mountPath)
|
||||
if !pathExists {
|
||||
klog.Warningf("Warning: Unmount skipped because path does not exist: %v", mountPath)
|
||||
|
@@ -582,7 +582,7 @@ func (hu *hostUtil) MakeFile(pathname string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (hu *hostUtil) ExistsPath(pathname string) (bool, error) {
|
||||
func (hu *hostUtil) PathExists(pathname string) (bool, error) {
|
||||
return utilpath.Exists(utilpath.CheckFollowSymlink, pathname)
|
||||
}
|
||||
|
||||
|
@@ -121,7 +121,7 @@ func (hu *hostUtil) MakeDir(pathname string) error {
|
||||
return errUnsupported
|
||||
}
|
||||
|
||||
func (hu *hostUtil) ExistsPath(pathname string) (bool, error) {
|
||||
func (hu *hostUtil) PathExists(pathname string) (bool, error) {
|
||||
return true, errUnsupported
|
||||
}
|
||||
|
||||
|
@@ -186,7 +186,7 @@ func (mounter *Mounter) IsLikelyNotMountPoint(file string) (bool, error) {
|
||||
return true, fmt.Errorf("readlink error: %v", err)
|
||||
}
|
||||
hu := NewHostUtil()
|
||||
exists, err := hu.ExistsPath(target)
|
||||
exists, err := hu.PathExists(target)
|
||||
if err != nil {
|
||||
return true, err
|
||||
}
|
||||
@@ -393,8 +393,8 @@ func (hu *hostUtil) MakeFile(pathname string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ExistsPath checks whether the path exists
|
||||
func (hu *hostUtil) ExistsPath(pathname string) (bool, error) {
|
||||
// PathExists checks whether the path exists
|
||||
func (hu *hostUtil) PathExists(pathname string) (bool, error) {
|
||||
return utilpath.Exists(utilpath.CheckFollowSymlink, pathname)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user