Fix merge
This commit is contained in:
parent
5693d0431e
commit
e53de71946
25
http.go
25
http.go
|
@ -543,31 +543,6 @@ func (rt *Router) routeServerBackup(w http.ResponseWriter, r *http.Request, ps h
|
|||
w.WriteHeader(http.StatusAccepted)
|
||||
}
|
||||
|
||||
func (rt *Router) routeServerBackup(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
||||
s := rt.GetServer(ps.ByName("server"))
|
||||
defer r.Body.Close()
|
||||
|
||||
data := rt.ReaderToBytes(r.Body)
|
||||
b, err := s.NewBackup(data)
|
||||
if err != nil {
|
||||
zap.S().Errorw("failed to create backup struct for server", zap.String("server", s.Uuid), zap.Error(err))
|
||||
|
||||
http.Error(w, "failed to update data structure", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
zap.S().Infow("starting backup process for server", zap.String("server", s.Uuid), zap.String("backup", b.Uuid))
|
||||
go func(bk *server.Backup) {
|
||||
if err := bk.BackupAndNotify(); err != nil {
|
||||
zap.S().Errorw("failed to generate backup for server", zap.Error(err))
|
||||
} else {
|
||||
zap.S().Infow("completed backup process for server", zap.String("backup", b.Uuid))
|
||||
}
|
||||
}(b)
|
||||
|
||||
w.WriteHeader(http.StatusAccepted)
|
||||
}
|
||||
|
||||
func (rt *Router) routeSystemInformation(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
||||
defer r.Body.Close()
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user