Signed-off-by: Christopher A. Stelma <stelminator@gmail.com>
pull/5422/head
Christopher A. Stelma 7 years ago
parent 03404cb01d
commit 92e375ab33

@ -87,7 +87,8 @@ func ensureDefaultRepos(home helmpath.Home, out io.Writer, skipRefresh bool, set
if fi, err := os.Stat(repoFile); err != nil { if fi, err := os.Stat(repoFile); err != nil {
fmt.Fprintf(out, "Creating %s \n", repoFile) fmt.Fprintf(out, "Creating %s \n", repoFile)
f := repo.NewRepoFile() f := repo.NewRepoFile()
// the cache path is prepended to all relative paths, for backwards compatibility, we must be relative to the cache directory // The cache path is prepended to all relative paths.
// For backwards compatibility, the repo path must be relative to the cache directory
sif, err := filepath.Rel(home.Cache(), home.CacheIndex(stableRepository)) sif, err := filepath.Rel(home.Cache(), home.CacheIndex(stableRepository))
if err != nil { if err != nil {
return err return err
@ -96,6 +97,7 @@ func ensureDefaultRepos(home helmpath.Home, out io.Writer, skipRefresh bool, set
if err != nil { if err != nil {
return err return err
} }
// Same for local repo path.
lif, err := filepath.Rel(home.Cache(), home.CacheIndex("local")) lif, err := filepath.Rel(home.Cache(), home.CacheIndex("local"))
if err != nil { if err != nil {
return err return err
@ -131,9 +133,7 @@ func initStableRepo(cacheFile string, home helmpath.Home, out io.Writer, skipRef
return &c, nil return &c, nil
} }
// In this case, the cacheFile is always absolute. So passing empty string if err := r.DownloadIndexFile(home.Cache()); err != nil {
// is safe.
if err := r.DownloadIndexFile(""); err != nil {
return nil, fmt.Errorf("Looks like %q is not a valid chart repository or cannot be reached: %s", stableRepositoryURL, err.Error()) return nil, fmt.Errorf("Looks like %q is not a valid chart repository or cannot be reached: %s", stableRepositoryURL, err.Error())
} }

@ -111,6 +111,8 @@ 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)
} }
// The cache path is prepended to all relative paths.
// For backwards compatibility, the repo path must be relative to the cache directory
cif, err := filepath.Rel(home.Cache(), home.CacheIndex(name)) cif, err := filepath.Rel(home.Cache(), home.CacheIndex(name))
if err != nil { if err != nil {
return err return err

Loading…
Cancel
Save