Simplify environment creation for server

This commit is contained in:
Dane Everitt
2020-09-12 21:48:04 -07:00
parent be49e08f4f
commit ce2659fdd7
4 changed files with 13 additions and 33 deletions

View File

@@ -57,7 +57,11 @@ func postCreateServer(c *gin.Context) {
// cycle. If there are any errors they will be logged and communicated back
// to the Panel where a reinstall may take place.
go func(i *installer.Installer) {
i.Execute()
err := i.Server().CreateEnvironment()
if err != nil {
i.Server().Log().WithField("error", err).Error("failed to create server environment during install process")
return
}
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")

View File

@@ -277,7 +277,10 @@ func postTransfer(c *gin.Context) {
server.GetServers().Add(i.Server())
// Create the server's environment (note this does not execute the install script)
i.Execute()
if err := i.Server().CreateEnvironment(); err != nil {
l.WithField("error", err).Error("failed to create server environment")
return
}
// Un-archive the archive. That sounds weird..
if err := archiver.NewTarGz().Unarchive(archivePath, i.Server().Filesystem.Path()); err != nil {