From 4e56ab7657abb781845dc58dd89cb7525df5b7eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20=C5=A0trauch?= Date: Mon, 1 Nov 2021 21:19:42 +0100 Subject: [PATCH] Size of the snapshot in metadata fix --- apps/snapshots.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/snapshots.go b/apps/snapshots.go index 4c00507..a98258b 100644 --- a/apps/snapshots.go +++ b/apps/snapshots.go @@ -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)