pull/3596/merge
Christopher Stelma 8 years ago committed by GitHub
commit d9051f66bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -90,7 +90,7 @@ func addRepository(name, url, username, password string, home helmpath.Home, cer
return fmt.Errorf("repository name (%s) already exists, please specify a different name", name) return fmt.Errorf("repository name (%s) already exists, please specify a different name", name)
} }
cif := home.CacheIndex(name) cif := home.CacheRelativeIndex(name)
c := repo.Entry{ c := repo.Entry{
Name: name, Name: name,
Cache: cif, Cache: cif,

@ -57,8 +57,13 @@ func (h Home) Cache() string {
// CacheIndex returns the path to an index for the given named repository. // CacheIndex returns the path to an index for the given named repository.
func (h Home) CacheIndex(name string) string { func (h Home) CacheIndex(name string) string {
return h.Path("repository", "cache", h.CacheRelativeIndex(name))
}
// 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) target := fmt.Sprintf("%s-index.yaml", name)
return h.Path("repository", "cache", target) return filepath.Join(target)
} }
// Starters returns the path to the Helm starter packs. // Starters returns the path to the Helm starter packs.

@ -36,6 +36,7 @@ func TestHelmHome(t *testing.T) {
isEq(t, hh.LocalRepository(), "/r/repository/local") isEq(t, hh.LocalRepository(), "/r/repository/local")
isEq(t, hh.Cache(), "/r/repository/cache") isEq(t, hh.Cache(), "/r/repository/cache")
isEq(t, hh.CacheIndex("t"), "/r/repository/cache/t-index.yaml") isEq(t, hh.CacheIndex("t"), "/r/repository/cache/t-index.yaml")
isEq(t, hh.CacheRelativeIndex("t"), "t-index.yaml")
isEq(t, hh.Starters(), "/r/starters") isEq(t, hh.Starters(), "/r/starters")
isEq(t, hh.Archive(), "/r/cache/archive") isEq(t, hh.Archive(), "/r/cache/archive")
isEq(t, hh.TLSCaCert(), "/r/ca.pem") isEq(t, hh.TLSCaCert(), "/r/ca.pem")

@ -33,6 +33,7 @@ func TestHelmHome(t *testing.T) {
isEq(t, hh.LocalRepository(), "r:\\repository\\local") isEq(t, hh.LocalRepository(), "r:\\repository\\local")
isEq(t, hh.Cache(), "r:\\repository\\cache") isEq(t, hh.Cache(), "r:\\repository\\cache")
isEq(t, hh.CacheIndex("t"), "r:\\repository\\cache\\t-index.yaml") isEq(t, hh.CacheIndex("t"), "r:\\repository\\cache\\t-index.yaml")
isEq(t, hh.CacheRelativeIndex("t"), "t-index.yaml")
isEq(t, hh.Starters(), "r:\\starters") isEq(t, hh.Starters(), "r:\\starters")
isEq(t, hh.Archive(), "r:\\cache\\archive") isEq(t, hh.Archive(), "r:\\cache\\archive")
isEq(t, hh.TLSCaCert(), "r:\\ca.pem") isEq(t, hh.TLSCaCert(), "r:\\ca.pem")

Loading…
Cancel
Save