Add support for reinstalling a server

This commit is contained in:
Dane Everitt
2020-04-03 13:43:13 -07:00
parent ddca34f9e8
commit 019d028011
4 changed files with 72 additions and 1 deletions

View File

@@ -36,6 +36,19 @@ func (s *Server) Install() error {
return err
}
// Reinstalls a server's software by utilizing the install script for the server egg. This
// does not touch any existing files for the server, other than what the script modifies.
func (s *Server) Reinstall() error {
if s.State != ProcessOfflineState {
zap.S().Debugw("waiting for server instance to enter a stopped state", zap.String("server", s.Uuid))
if err := s.Environment.WaitForStop(10, true); err != nil {
return err
}
}
return s.Install()
}
// Internal installation function used to simplify reporting back to the Panel.
func (s *Server) internalInstall() error {
script, rerr, err := api.NewRequester().GetInstallationScript(s.Uuid)