1
0
mirror of https://github.com/bingohuang/docker-labs.git synced 2025-07-14 18:27:25 +08:00
docker-labs/services/check_swarm_status_task.go
Jonathan Leibiusky afa47c0bfc Periodic tasks refactor (#62)
* Once every second the session run a list of periodic tasks on every
instance concurrently. We use these tasks to do things like:
- Collect mem and cpu stats
- Check if instance is part of a swarm cluster
- Broadcast information to connected clients
2016-12-01 15:57:30 -03:00

16 lines
384 B
Go

package services
import "github.com/docker/docker/api/types/swarm"
type checkSwarmStatusTask struct {
}
func (c checkSwarmStatusTask) Run(i *Instance) {
if info, err := GetDaemonInfo(i); err == nil {
if info.Swarm.LocalNodeState != swarm.LocalNodeStateInactive && info.Swarm.LocalNodeState != swarm.LocalNodeStateLocked {
i.IsManager = &info.Swarm.ControlAvailable
}
}
}