Remove `CachePath` from `Entry`

It will have to be customized manually in `ChartRepository` after its creation.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
pull/31092/head
Douglas Camata 2 months ago
parent fecf20e668
commit 7fca7d505f
No known key found for this signature in database

@ -48,7 +48,6 @@ type Entry struct {
CAFile string `json:"caFile"`
InsecureSkipTLSverify bool `json:"insecure_skip_tls_verify"`
PassCredentialsAll bool `json:"pass_credentials_all"`
CachePath string `json:"cache_path"`
}
// ChartRepository represents a chart repository
@ -72,16 +71,11 @@ func NewChartRepository(cfg *Entry, getters getter.Providers) (*ChartRepository,
return nil, errors.Errorf("could not find protocol handler for: %s", u.Scheme)
}
cachePath := helmpath.CachePath("repository")
if cfg.CachePath != "" {
cachePath = cfg.CachePath
}
return &ChartRepository{
Config: cfg,
IndexFile: NewIndexFile(),
Client: client,
CachePath: cachePath,
CachePath: helmpath.CachePath("repository"),
}, nil
}
@ -245,12 +239,14 @@ func FindChartInAuthAndTLSAndPassRepoURL(repoURL, username, password, chartName,
CAFile: caFile,
Name: name,
InsecureSkipTLSverify: insecureSkipTLSverify,
CachePath: cachePath,
}
r, err := NewChartRepository(&c, getters)
if err != nil {
return "", err
}
if cachePath != "" {
r.CachePath = cachePath
}
idx, err := r.DownloadIndexFile()
if err != nil {
return "", errors.Wrapf(err, "looks like %q is not a valid chart repository or cannot be reached", repoURL)

@ -85,12 +85,13 @@ func TestNewChartRepositoryWithCachePath(t *testing.T) {
r, err := NewChartRepository(&Entry{
Name: testRepository,
URL: srv.URL,
CachePath: cacheDir,
}, getter.All(&cli.EnvSettings{}))
if err != nil {
t.Errorf("Problem creating chart repository from %s: %v", testRepository, err)
}
r.CachePath = cacheDir
if err := r.Load(); err != nil {
t.Errorf("Problem loading chart repository from %s: %v", testRepository, err)
}

Loading…
Cancel
Save