Merge pull request #81204 from codenrhoden/rename-hu-pathexists

Rename HostUtils.ExistsPath to PathExists
This commit is contained in:
Kubernetes Prow Robot
2019-08-12 20:12:12 -07:00
committed by GitHub
11 changed files with 20 additions and 21 deletions

View File

@@ -21,7 +21,7 @@ import (
"os"
"regexp"
"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/uuid"
@@ -365,7 +365,7 @@ type fileTypeChecker struct {
}
func (ftc *fileTypeChecker) Exists() bool {
exists, err := ftc.hu.ExistsPath(ftc.path)
exists, err := ftc.hu.PathExists(ftc.path)
return exists && err == nil
}

View File

@@ -316,9 +316,9 @@ func (hu *hostUtil) MakeFile(pathname string) error {
return nil
}
// ExistsPath checks if pathname exists.
// PathExists checks if pathname exists.
// Error is returned on any other error than "file not found".
func (hu *hostUtil) ExistsPath(pathname string) (bool, error) {
func (hu *hostUtil) PathExists(pathname string) (bool, error) {
// Resolve the symlinks but allow the target not to exist. EvalSymlinks
// would return an generic error when the target does not exist.
hostPath, err := hu.ne.EvalSymlinks(pathname, false /* mustExist */)

View File

@@ -170,8 +170,8 @@ func TestNsenterExistsFile(t *testing.T) {
return path, nil
},
expectedOutput: isRoot, // ExistsPath success when running as root
expectError: !isRoot, // ExistsPath must fail when running as not-root
expectedOutput: isRoot, // PathExists success when running as root
expectError: !isRoot, // PathExists must fail when running as not-root
},
{
name: "relative symlink to existing file",
@@ -278,7 +278,7 @@ func TestNsenterExistsFile(t *testing.T) {
continue
}
out, err := hu.ExistsPath(path)
out, err := hu.PathExists(path)
if err != nil && !test.expectError {
t.Errorf("Test %q: unexpected error: %s", test.name, err)
}

View File

@@ -122,9 +122,9 @@ func (*hostUtil) MakeFile(pathname string) error {
return nil
}
// ExistsPath checks if pathname exists. Always returns an error on unsupported
// PathExists checks if pathname exists. Always returns an error on unsupported
// platforms
func (*hostUtil) ExistsPath(pathname string) (bool, error) {
func (*hostUtil) PathExists(pathname string) (bool, error) {
return true, errors.New("not implemented")
}