close gzip writer before uploading volumesnapshots file

Signed-off-by: Steve Kriss <steve@heptio.com>
This commit is contained in:
Steve Kriss
2018-10-15 14:22:00 -06:00
parent da9ed38c63
commit 35bb533c2d

View File

@@ -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.