Don't allow a reinstall while server is processing a power action; closes pterodactyl/panel#2409

This commit is contained in:
Dane Everitt 2020-09-25 20:03:04 -07:00
parent ae5005baa3
commit fb24ad58b4
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53
2 changed files with 11 additions and 4 deletions

View File

@ -169,9 +169,16 @@ func postServerInstall(c *gin.Context) {
func postServerReinstall(c *gin.Context) {
s := GetServer(c.Param("server"))
go func(serv *server.Server) {
if err := serv.Reinstall(); err != nil {
serv.Log().WithField("error", err).Error("failed to complete server re-install process")
if s.ExecutingPowerAction() {
c.AbortWithStatusJSON(http.StatusConflict, gin.H{
"error": "Cannot execute server reinstall event while another power action is running.",
})
return
}
go func(s *server.Server) {
if err := s.Reinstall(); err != nil {
s.Log().WithField("error", err).Error("failed to complete server re-install process")
}
}(s)

View File

@ -168,7 +168,7 @@ func (s *Server) onBeforeStart() error {
} else {
s.PublishConsoleOutputFromDaemon("Checking server disk space usage, this could take a few seconds...")
if !s.Filesystem.HasSpaceAvailable(false) {
return errors.New("cannot start server, not enough disk space available")
return ErrNotEnoughDiskSpace
}
}