Delete residual file caused by network interruption and so on. Fixes #3204 (#3241)

Signed-off-by: huangkai <huangkai76@huawei.com>
This commit is contained in:
Kyle William
2021-06-03 04:41:50 +08:00
committed by GitHub
parent 61c12a8171
commit 030104f179
2 changed files with 5 additions and 1 deletions

View File

@@ -304,11 +304,11 @@ func (c *backupDeletionController) processRequest(req *velerov1api.DeleteBackupR
if len(actions) > 0 {
// Download the tarball
backupFile, err := downloadToTempFile(backup.Name, backupStore, log)
defer closeAndRemoveFile(backupFile, c.logger)
if err != nil {
log.WithError(err).Errorf("Unable to download tarball for backup %s, skipping associated DeleteItemAction plugins", backup.Name)
} else {
defer closeAndRemoveFile(backupFile, c.logger)
ctx := &delete.Context{
Backup: backup,
BackupReader: backupFile,