Merge pull request #11172 from crenshaw-dev/cleanup-after-find-chart

fix: clean up temp files in FindChartInAuthAndTLSAndPassRepoURL (#11171)
This commit is contained in:
Matt Farina
2022-10-11 13:58:46 -04:00
committed by GitHub

View File

@@ -253,6 +253,10 @@ func FindChartInAuthAndTLSAndPassRepoURL(repoURL, username, password, chartName,
if err != nil {
return "", errors.Wrapf(err, "looks like %q is not a valid chart repository or cannot be reached", repoURL)
}
defer func() {
os.RemoveAll(filepath.Join(r.CachePath, helmpath.CacheChartsFile(r.Config.Name)))
os.RemoveAll(filepath.Join(r.CachePath, helmpath.CacheIndexFile(r.Config.Name)))
}()
// Read the index file for the repository to get chart information and return chart URL
repoIndex, err := LoadIndexFile(idx)