server(install): update installation status request

The new request includes a `reinstall` option to denote
whether the installation failed for the first time, or
during a reinstall.

ref https://github.com/pterodactyl/panel/issues/1994
This commit is contained in:
Matthew Penner
2022-11-21 14:57:44 -07:00
parent 51cb6dfa42
commit da94f750ad
6 changed files with 72 additions and 53 deletions

View File

@@ -153,9 +153,15 @@ func postServerSync(c *gin.Context) {
func postServerInstall(c *gin.Context) {
s := ExtractServer(c)
go func(serv *server.Server) {
if err := serv.Install(true); err != nil {
serv.Log().WithField("error", err).Error("failed to execute server installation process")
go func(s *server.Server) {
s.Log().Info("syncing server state with remote source before executing installation process")
if err := s.Sync(); err != nil {
s.Log().WithField("error", err).Error("failed to sync server state with Panel")
return
}
if err := s.Install(); err != nil {
s.Log().WithField("error", err).Error("failed to execute server installation process")
}
}(s)

View File

@@ -75,7 +75,7 @@ func postCreateServer(c *gin.Context) {
return
}
if err := i.Server().Install(false); err != nil {
if err := i.Server().Install(); err != nil {
log.WithFields(log.Fields{"server": i.Server().ID(), "error": err}).Error("failed to run install process for server")
return
}