Files
play-with-docker/pwd/check_used_ports_task.go
Jonathan Leibiusky @xetorthio e9911abf94 Storage has now it's own package.
Remove global `sessions` map and use configured storage.
Add a `types` package so both `pwd` and `storage` can access without
circular dependencies.
Now the session is prepared when requested and not on load.
2017-06-15 16:09:41 -03:00

26 lines
395 B
Go

package pwd
import (
"log"
"github.com/play-with-docker/play-with-docker/pwd/types"
)
type checkUsedPortsTask struct {
}
func (c checkUsedPortsTask) Run(i *types.Instance) error {
if i.Docker == nil {
return nil
}
if ports, err := i.Docker.GetPorts(); err == nil {
for _, p := range ports {
i.SetUsedPort(uint16(p))
}
} else {
log.Println(err)
return err
}
return nil
}