diff --git a/cmd/helm/init.go b/cmd/helm/init.go index e1fab6618..671d91c3e 100644 --- a/cmd/helm/init.go +++ b/cmd/helm/init.go @@ -23,7 +23,6 @@ import ( "fmt" "io" "os" - "path/filepath" "github.com/spf13/cobra" apierrors "k8s.io/apimachinery/pkg/api/errors" @@ -392,11 +391,9 @@ func initLocalRepo(indexFile, cacheFile string, out io.Writer, home helmpath.Hom } //TODO: take this out and replace with helm update functionality - fp, err := filepath.Rel(home.Cache(), indexFile) - if err != nil { + if err := createLink(indexFile, cacheFile, home); err != nil { return nil, err } - createLink(fp, filepath.Join(home.Cache(), cacheFile)) } else if fi.IsDir() { return nil, fmt.Errorf("%s must be a file, not a directory", indexFile) } diff --git a/cmd/helm/init_unix.go b/cmd/helm/init_unix.go index ff6260434..20458a182 100644 --- a/cmd/helm/init_unix.go +++ b/cmd/helm/init_unix.go @@ -20,8 +20,15 @@ package main import ( "os" + "path/filepath" + + "k8s.io/helm/pkg/helm/helmpath" ) -func createLink(indexFile, cacheFile string) { - os.Symlink(indexFile, cacheFile) +func createLink(indexFile, cacheFile string, home helmpath.Home) error { + fp, err := filepath.Rel(home.Cache(), indexFile) + if err != nil { + return err + } + return os.Symlink(fp, filepath.Join(home.Cache(), cacheFile)) } diff --git a/cmd/helm/init_windows.go b/cmd/helm/init_windows.go index 73ae6c6de..be17bccda 100644 --- a/cmd/helm/init_windows.go +++ b/cmd/helm/init_windows.go @@ -20,8 +20,10 @@ package main import ( "os" + + "k8s.io/helm/pkg/helm/helmpath" ) -func createLink(indexFile, cacheFile string) { - os.Link(indexFile, cacheFile) +func createLink(indexFile, cacheFile string, home helmpath.Home) error { + return os.Link(indexFile, cacheFile) }