Sync server state with Panel before performing installation to ensure information is up to date
This commit is contained in:
parent
79a582a5f2
commit
ea2630946a
|
@ -135,7 +135,7 @@ func postServerInstall(c *gin.Context) {
|
||||||
s := GetServer(c.Param("server"))
|
s := GetServer(c.Param("server"))
|
||||||
|
|
||||||
go func(serv *server.Server) {
|
go func(serv *server.Server) {
|
||||||
if err := serv.Install(); err != nil {
|
if err := serv.Install(true); err != nil {
|
||||||
serv.Log().WithField("error", err).Error("failed to execute server installation process")
|
serv.Log().WithField("error", err).Error("failed to execute server installation process")
|
||||||
}
|
}
|
||||||
}(s)
|
}(s)
|
||||||
|
|
|
@ -59,7 +59,7 @@ func postCreateServer(c *gin.Context) {
|
||||||
go func(i *installer.Installer) {
|
go func(i *installer.Installer) {
|
||||||
i.Execute()
|
i.Execute()
|
||||||
|
|
||||||
if err := i.Server().Install(); err != nil {
|
if err := i.Server().Install(false); err != nil {
|
||||||
log.WithFields(log.Fields{"server": i.Uuid(), "error": err}).Error("failed to run install process for server")
|
log.WithFields(log.Fields{"server": i.Uuid(), "error": err}).Error("failed to run install process for server")
|
||||||
}
|
}
|
||||||
}(install)
|
}(install)
|
||||||
|
|
|
@ -25,7 +25,17 @@ import (
|
||||||
|
|
||||||
// Executes the installation stack for a server process. Bubbles any errors up to the calling
|
// Executes the installation stack for a server process. Bubbles any errors up to the calling
|
||||||
// function which should handle contacting the panel to notify it of the server state.
|
// function which should handle contacting the panel to notify it of the server state.
|
||||||
func (s *Server) Install() error {
|
//
|
||||||
|
// Pass true as the first arugment in order to execute a server sync before the process to
|
||||||
|
// ensure the latest information is used.
|
||||||
|
func (s *Server) Install(sync bool) error {
|
||||||
|
if sync {
|
||||||
|
s.Log().Info("syncing server state with remote source before executing installation process")
|
||||||
|
if err := s.Sync(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
err := s.internalInstall()
|
err := s.internalInstall()
|
||||||
|
|
||||||
s.Log().Debug("notifying panel of server install state")
|
s.Log().Debug("notifying panel of server install state")
|
||||||
|
@ -55,7 +65,7 @@ func (s *Server) Reinstall() error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return s.Install()
|
return s.Install(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Internal installation function used to simplify reporting back to the Panel.
|
// Internal installation function used to simplify reporting back to the Panel.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user