diff --git a/cmd/helm/fetch.go b/cmd/helm/fetch.go index bc1c07cb7..6af84d00d 100644 --- a/cmd/helm/fetch.go +++ b/cmd/helm/fetch.go @@ -166,13 +166,13 @@ func (f *fetchCmd) run() error { if !filepath.IsAbs(ud) { ud = filepath.Join(f.destdir, ud) } - if fi, err := os.Stat(ud); err != nil { + if _, err := os.Stat(ud); err != nil { if err := os.MkdirAll(ud, 0755); err != nil { return fmt.Errorf("Failed to untar (mkdir): %s", err) } - } else if !fi.IsDir() { - return fmt.Errorf("Failed to untar: %s is not a directory", ud) + } else { + return fmt.Errorf("ailed to untar: a file or directory with the name %s already exists", ud) } return chartutil.ExpandFile(ud, saved) diff --git a/cmd/helm/fetch_test.go b/cmd/helm/fetch_test.go index 3fba37dd6..d6ffc17a1 100644 --- a/cmd/helm/fetch_test.go +++ b/cmd/helm/fetch_test.go @@ -105,6 +105,8 @@ func TestFetchCmd(t *testing.T) { expectFile: "./signtest", expectDir: true, expectVerify: true, + failExpect: "Failed to untar signtest", + fail: true, }, { name: "Chart fetch using repo URL",