Send restoration status information to the console
This commit is contained in:
parent
adc0732af3
commit
4bd18f7dd8
|
@ -99,12 +99,15 @@ func postServerRestoreBackup(c *gin.Context) {
|
||||||
middleware.CaptureAndAbort(c, err)
|
middleware.CaptureAndAbort(c, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
go func(logger *log.Entry) {
|
go func(s *server.Server, b backup.BackupInterface, logger *log.Entry) {
|
||||||
logger.Info("restoring server from local backup...")
|
logger.Info("starting restoration process for server backup using local driver")
|
||||||
if err := s.RestoreBackup(b, nil); err != nil {
|
if err := s.RestoreBackup(b, nil); err != nil {
|
||||||
logger.WithField("error", err).Error("failed to restore local backup to server")
|
logger.WithField("error", err).Error("failed to restore local backup to server")
|
||||||
}
|
}
|
||||||
}(logger)
|
s.Events().Publish(server.DaemonMessageEvent, "Completed server restoration from local backup.")
|
||||||
|
s.Events().Publish(server.BackupRestoreCompletedEvent, "")
|
||||||
|
logger.Info("completed server restoration from local backup")
|
||||||
|
}(s, b, logger)
|
||||||
c.Status(http.StatusAccepted)
|
c.Status(http.StatusAccepted)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -143,6 +146,7 @@ func postServerRestoreBackup(c *gin.Context) {
|
||||||
if err := s.RestoreBackup(backup.NewS3(uuid, ""), res.Body); err != nil {
|
if err := s.RestoreBackup(backup.NewS3(uuid, ""), res.Body); err != nil {
|
||||||
logger.WithField("error", errors.WithStack(err)).Error("failed to restore remote S3 backup to server")
|
logger.WithField("error", errors.WithStack(err)).Error("failed to restore remote S3 backup to server")
|
||||||
}
|
}
|
||||||
|
s.Events().Publish(server.DaemonMessageEvent, "Completed server restoration from S3 backup.")
|
||||||
s.Events().Publish(server.BackupRestoreCompletedEvent, "")
|
s.Events().Publish(server.BackupRestoreCompletedEvent, "")
|
||||||
logger.Info("completed server restoration from S3 backup")
|
logger.Info("completed server restoration from S3 backup")
|
||||||
}(s, c.Param("backup"), logger)
|
}(s, c.Param("backup"), logger)
|
||||||
|
|
|
@ -151,6 +151,7 @@ func (s *Server) RestoreBackup(b backup.BackupInterface, reader io.ReadCloser) (
|
||||||
// in the file one at a time and writing them to the disk.
|
// in the file one at a time and writing them to the disk.
|
||||||
s.Log().Debug("starting file writing process for backup restoration")
|
s.Log().Debug("starting file writing process for backup restoration")
|
||||||
err = b.Restore(reader, func(file string, r io.Reader) error {
|
err = b.Restore(reader, func(file string, r io.Reader) error {
|
||||||
|
s.Events().Publish(DaemonMessageEvent, "(restoring): "+file)
|
||||||
return s.Filesystem().Writefile(file, r)
|
return s.Filesystem().Writefile(file, r)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user