From 4ed8e770260cd9f6800b86347c1cbe8bf56eacbe Mon Sep 17 00:00:00 2001 From: Josh Dolitsky Date: Fri, 18 Jun 2021 17:39:28 -0400 Subject: [PATCH] remove tmp path in case it exists Signed-off-by: Josh Dolitsky --- pkg/downloader/manager.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/downloader/manager.go b/pkg/downloader/manager.go index 47bd88507..a71a9c60b 100644 --- a/pkg/downloader/manager.go +++ b/pkg/downloader/manager.go @@ -258,6 +258,9 @@ func (m *Manager) downloadAll(deps []*chart.Dependency) error { return errors.Errorf("%q is not a directory", destPath) } + if err := os.RemoveAll(tmpPath); err != nil { + return errors.Wrapf(err, "failed to remove %v", tmpPath) + } if err := fs.RenameWithFallback(destPath, tmpPath); err != nil { return errors.Wrap(err, "unable to move current charts to tmp dir") }