diff --git a/cmd/helm/repo_add.go b/cmd/helm/repo_add.go index 7fb20d02d..669df9b56 100644 --- a/cmd/helm/repo_add.go +++ b/cmd/helm/repo_add.go @@ -86,7 +86,7 @@ func addRepository(name, url string, home helmpath.Home, certFile, keyFile, caFi return fmt.Errorf("repository name (%s) already exists, please specify a different name", name) } - cif := home.RelativeIndex(name) + cif := home.CacheRelativeIndex(name) c := repo.Entry{ Name: name, Cache: cif, diff --git a/pkg/helm/helmpath/helmhome.go b/pkg/helm/helmpath/helmhome.go index 3c35c3b69..9d2899e4c 100644 --- a/pkg/helm/helmpath/helmhome.go +++ b/pkg/helm/helmpath/helmhome.go @@ -57,12 +57,11 @@ func (h Home) Cache() string { // CacheIndex returns the path to an index for the given named repository. func (h Home) CacheIndex(name string) string { - target := fmt.Sprintf("%s-index.yaml", name) - return h.Path("repository", "cache", target) + return h.Path("repository", "cache", h.CacheRelativeIndex(name)) } -// RelativeIndex returns the relative path to an index for the given named repository. -func (h Home) RelativeIndex(name string) string { +// CacheRelativeIndex returns the relative path to an index for the given named repository from the cache path. +func (h Home) CacheRelativeIndex(name string) string { target := fmt.Sprintf("%s-index.yaml", name) return filepath.Join(target) } diff --git a/pkg/helm/helmpath/helmhome_unix_test.go b/pkg/helm/helmpath/helmhome_unix_test.go index 634faeef7..6a0d77bb6 100644 --- a/pkg/helm/helmpath/helmhome_unix_test.go +++ b/pkg/helm/helmpath/helmhome_unix_test.go @@ -36,7 +36,7 @@ func TestHelmHome(t *testing.T) { isEq(t, hh.LocalRepository(), "/r/repository/local") isEq(t, hh.Cache(), "/r/repository/cache") isEq(t, hh.CacheIndex("t"), "/r/repository/cache/t-index.yaml") - isEq(t, hh.RelativeIndex("t"), "t-index.yaml") + isEq(t, hh.CacheRelativeIndex("t"), "t-index.yaml") isEq(t, hh.Starters(), "/r/starters") isEq(t, hh.Archive(), "/r/cache/archive") isEq(t, hh.TLSCaCert(), "/r/ca.pem") diff --git a/pkg/helm/helmpath/helmhome_windows_test.go b/pkg/helm/helmpath/helmhome_windows_test.go index 43db9b8f1..fd7b27e63 100644 --- a/pkg/helm/helmpath/helmhome_windows_test.go +++ b/pkg/helm/helmpath/helmhome_windows_test.go @@ -33,7 +33,7 @@ func TestHelmHome(t *testing.T) { isEq(t, hh.LocalRepository(), "r:\\repository\\local") isEq(t, hh.Cache(), "r:\\repository\\cache") isEq(t, hh.CacheIndex("t"), "r:\\repository\\cache\\t-index.yaml") - isEq(t, hh.RelativeIndex("t"), "t-index.yaml") + isEq(t, hh.CacheRelativeIndex("t"), "t-index.yaml") isEq(t, hh.Starters(), "r:\\starters") isEq(t, hh.Archive(), "r:\\cache\\archive") isEq(t, hh.TLSCaCert(), "r:\\ca.pem")