Skip to content

Commit

Permalink
Merge pull request #9877 from johngmyers/fspath-notexist
Browse files Browse the repository at this point in the history
Map ENOENT to ErrNotExist in FSPath
  • Loading branch information
k8s-ci-robot authored Sep 6, 2020
2 parents d7fbc2f + 1e92c77 commit d90c90c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion util/pkg/vfs/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"os"
"path"
"sync"
"syscall"

"k8s.io/klog/v2"
"k8s.io/kops/pkg/try"
Expand Down Expand Up @@ -112,7 +113,11 @@ func (p *FSPath) CreateFile(data io.ReadSeeker, acl ACL) error {

// ReadFile implements Path::ReadFile
func (p *FSPath) ReadFile() ([]byte, error) {
return ioutil.ReadFile(p.location)
file, err := ioutil.ReadFile(p.location)
if err == syscall.ENOENT {
err = os.ErrNotExist
}
return file, err
}

// WriteTo implements io.WriterTo
Expand Down

0 comments on commit d90c90c

Please sign in to comment.