Correctly return the suspension status of the server
This commit is contained in:
parent
c69a0bb107
commit
7d084e3049
|
@ -27,9 +27,9 @@ func New(data []byte) (*Installer, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg := &server.Configuration{
|
cfg := &server.Configuration{
|
||||||
Uuid: getString(data, "uuid"),
|
Uuid: getString(data, "uuid"),
|
||||||
Suspended: false,
|
Suspended: false,
|
||||||
Invocation: getString(data, "invocation"),
|
Invocation: getString(data, "invocation"),
|
||||||
SkipEggScripts: getBoolean(data, "skip_egg_scripts"),
|
SkipEggScripts: getBoolean(data, "skip_egg_scripts"),
|
||||||
Build: environment.Limits{
|
Build: environment.Limits{
|
||||||
MemoryLimit: getInt(data, "build", "memory"),
|
MemoryLimit: getInt(data, "build", "memory"),
|
||||||
|
|
|
@ -12,13 +12,19 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type serverProcData struct {
|
||||||
|
server.ResourceUsage
|
||||||
|
Suspended bool `json:"suspended"`
|
||||||
|
}
|
||||||
|
|
||||||
// Returns a single server from the collection of servers.
|
// Returns a single server from the collection of servers.
|
||||||
func getServer(c *gin.Context) {
|
func getServer(c *gin.Context) {
|
||||||
s := GetServer(c.Param("server"))
|
s := GetServer(c.Param("server"))
|
||||||
|
|
||||||
p := *s.Proc()
|
c.JSON(http.StatusOK, serverProcData{
|
||||||
|
ResourceUsage: *s.Proc(),
|
||||||
c.JSON(http.StatusOK, p)
|
Suspended: s.IsSuspended(),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the logs for a given server instance.
|
// Returns the logs for a given server instance.
|
||||||
|
@ -50,7 +56,7 @@ func getServerLogs(c *gin.Context) {
|
||||||
func postServerPower(c *gin.Context) {
|
func postServerPower(c *gin.Context) {
|
||||||
s := GetServer(c.Param("server"))
|
s := GetServer(c.Param("server"))
|
||||||
|
|
||||||
var data struct{
|
var data struct {
|
||||||
Action server.PowerAction `json:"action"`
|
Action server.PowerAction `json:"action"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,7 +214,7 @@ func deleteServer(c *gin.Context) {
|
||||||
go func(p string) {
|
go func(p string) {
|
||||||
if err := os.RemoveAll(p); err != nil {
|
if err := os.RemoveAll(p); err != nil {
|
||||||
log.WithFields(log.Fields{
|
log.WithFields(log.Fields{
|
||||||
"path": p,
|
"path": p,
|
||||||
"error": errors.WithStack(err),
|
"error": errors.WithStack(err),
|
||||||
}).Warn("failed to remove server files during deletion process")
|
}).Warn("failed to remove server files during deletion process")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user