2016-06-29 18:00:11 +00:00
|
|
|
package main
|
|
|
|
|
2016-12-09 09:17:53 +00:00
|
|
|
import (
|
|
|
|
"github.com/docker/docker/integration-cli/daemon"
|
|
|
|
"github.com/go-check/check"
|
|
|
|
)
|
2016-06-29 18:00:11 +00:00
|
|
|
|
2018-04-11 10:10:17 +00:00
|
|
|
func (s *DockerSwarmSuite) getDaemon(c *check.C, nodeID string) *daemon.Daemon {
|
2016-06-29 18:00:11 +00:00
|
|
|
s.daemonsLock.Lock()
|
|
|
|
defer s.daemonsLock.Unlock()
|
|
|
|
for _, d := range s.daemons {
|
2018-04-11 10:10:17 +00:00
|
|
|
if d.NodeID() == nodeID {
|
2016-06-29 18:00:11 +00:00
|
|
|
return d
|
|
|
|
}
|
|
|
|
}
|
|
|
|
c.Fatalf("could not find node with id: %s", nodeID)
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// nodeCmd executes a command on a given node via the normal docker socket
|
2016-07-22 16:14:05 +00:00
|
|
|
func (s *DockerSwarmSuite) nodeCmd(c *check.C, id string, args ...string) (string, error) {
|
|
|
|
return s.getDaemon(c, id).Cmd(args...)
|
2016-06-29 18:00:11 +00:00
|
|
|
}
|