From 35bb533c2d0f87ff7b5eb9cc90fcaea62c50a3d4 Mon Sep 17 00:00:00 2001 From: Steve Kriss Date: Mon, 15 Oct 2018 14:22:00 -0600 Subject: [PATCH] close gzip writer before uploading volumesnapshots file Signed-off-by: Steve Kriss --- pkg/controller/backup_controller.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/controller/backup_controller.go b/pkg/controller/backup_controller.go index 0a85703a09..e70f1b5379 100644 --- a/pkg/controller/backup_controller.go +++ b/pkg/controller/backup_controller.go @@ -440,6 +440,9 @@ func persistBackup(backup *pkgbackup.Request, backupContents, backupLog *os.File if err := json.NewEncoder(gzw).Encode(backup.VolumeSnapshots); err != nil { errs = append(errs, errors.Wrap(err, "error encoding list of volume snapshots")) } + if err := gzw.Close(); err != nil { + errs = append(errs, errors.Wrap(err, "error closing gzip writer")) + } if len(errs) > 0 { // Don't upload the JSON files or backup tarball if encoding to json fails.