Skip to content

Commit

Permalink
one defer
Browse files Browse the repository at this point in the history
Signed-off-by: CI <ci@argoproj.com>
(cherry picked from commit 3b19dde)
  • Loading branch information
CI authored and mattfarina committed Oct 12, 2022
1 parent 9f61b0a commit 97780c7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/repo/chartrepo.go
Expand Up @@ -253,8 +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 os.RemoveAll(filepath.Join(r.CachePath, helmpath.CacheChartsFile(r.Config.Name)))
defer os.RemoveAll(filepath.Join(r.CachePath, helmpath.CacheIndexFile(r.Config.Name)))
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)
Expand Down

0 comments on commit 97780c7

Please sign in to comment.