Size of the snapshot in metadata fix
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Adam Štrauch 2021-11-01 21:19:42 +01:00
parent d2b935b85c
commit 4e56ab7657
Signed by: cx
GPG Key ID: 018304FFA8988F8D

View File

@ -142,14 +142,9 @@ func (s *SnapshotProcessor) CreateSnapshot(appName string, labels []string) (str
Labels: labels,
}
err := s.saveMetadata(snapshot)
if err != nil {
return snapshot.KeyName(s.IndexLabel), fmt.Errorf("saving metadata error: %v", err)
}
tmpSnapshotArchivePath := path.Join(s.TmpSnapshotPath, snapshot.KeyName(s.IndexLabel)+".tar.zst")
err = os.Chdir(path.Join(s.AppsPath, appName))
err := os.Chdir(path.Join(s.AppsPath, appName))
if err != nil {
return snapshot.KeyName(s.IndexLabel), fmt.Errorf("change working directory error: %v", err)
}
@ -165,6 +160,11 @@ func (s *SnapshotProcessor) CreateSnapshot(appName string, labels []string) (str
}
snapshot.Labels = append(snapshot.Labels, fmt.Sprintf("size:%d", info.Size()))
err = s.saveMetadata(snapshot)
if err != nil {
return snapshot.KeyName(s.IndexLabel), fmt.Errorf("saving metadata error: %v", err)
}
// Clean after myself
defer func() {
err = os.Remove(tmpSnapshotArchivePath)