Skip to content

Commit 6ee1936

Browse files
committed
chore: file mode
1 parent 16a338f commit 6ee1936

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

internal/core/services/snapshot/restore_service.go

+11-4
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,14 @@ func (rc *SnapshotService) RestoreSnapshot(dir string, source string, options po
153153
}
154154
}
155155
}
156+
157+
//recreate dir with 775 permission
158+
const FileMode = 0775
159+
err := os.MkdirAll(dir, FileMode)
160+
if err != nil {
161+
return err
162+
}
163+
156164
progressReader := &ProgressTracker{}
157165

158166
rc.setActivity(ports.SnapshotModeRestore, progressReader)
@@ -168,10 +176,7 @@ func (rc *SnapshotService) RestoreSnapshot(dir string, source string, options po
168176
logger.Log().Info("Restoring backup", zap.String("source", source), zap.String("destination", dir))
169177

170178
// Download the file
171-
err := client.Get()
172-
173-
logger.Log().Info("Backup restored", zap.String("source", source), zap.String("destination", dir))
174-
179+
err = client.Get()
175180
if err != nil {
176181
logger.Log().Error("Error occured while getting backup", zap.Error(err))
177182
if options.Safe {
@@ -183,6 +188,8 @@ func (rc *SnapshotService) RestoreSnapshot(dir string, source string, options po
183188
}
184189
return err
185190
}
191+
192+
logger.Log().Info("Backup restored", zap.String("source", source), zap.String("destination", dir))
186193
return os.RemoveAll(temDir)
187194
}
188195

0 commit comments

Comments
 (0)