mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-08-15 19:56:06 +00:00
backup download: remove file if there's an error
Signed-off-by: Andy Goldstein <andy.goldstein@gmail.com>
This commit is contained in:
@@ -107,7 +107,10 @@ func (o *DownloadOptions) Run(c *cobra.Command, f client.Factory) error {
|
||||
defer backupDest.Close()
|
||||
|
||||
err = downloadrequest.Stream(arkClient.ArkV1(), o.Name, v1.DownloadTargetKindBackupContents, backupDest, o.Timeout)
|
||||
cmd.CheckError(err)
|
||||
if err != nil {
|
||||
os.Remove(o.Output)
|
||||
cmd.CheckError(err)
|
||||
}
|
||||
|
||||
fmt.Printf("Backup %s has been successfully downloaded to %s\n", o.Name, backupDest.Name())
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user