Fixed not call port forwarding methods if spin up/down operations fail.

This commit is contained in:
Gary Talent 2016-02-27 16:15:42 -06:00
parent b31b18674c
commit 782072e3fa

View File

@ -79,14 +79,16 @@ func (me *ServerManager) serveAction(action int) bool {
switch action { switch action {
case SERVERMANAGER_SPINUP: case SERVERMANAGER_SPINUP:
ip, err := me.server.Spinup(me.name) ip, err := me.server.Spinup(me.name)
if err == nil {
me.addPortForwards(ip) me.addPortForwards(ip)
if err != nil { } else {
log.Println("ServerManager: Could not spin up "+me.name+":", err) log.Println("ServerManager: Could not spin up "+me.name+":", err)
} }
case SERVERMANAGER_SPINDOWN: case SERVERMANAGER_SPINDOWN:
err := me.server.Spindown(me.name) err := me.server.Spindown(me.name)
if err == nil {
me.rmPortForwards() me.rmPortForwards()
if err != nil { } else {
log.Println("ServerManager: Could not spin down "+me.name+":", err) log.Println("ServerManager: Could not spin down "+me.name+":", err)
} }
case SERVERMANAGER_STOP: case SERVERMANAGER_STOP: