MCPcopy Create free account
hub / github.com/commander-cli/commander / getExecutor

Method getExecutor

pkg/runtime/runner.go:73–98  ·  view source on GitHub ↗

getExecutor gets the node by the name it matches within the runner config

(node string)

Source from the content-addressed store, hash-verified

71
72// getExecutor gets the node by the name it matches within the runner config
73func (r *Runner) getExecutor(node string) Executor {
74 for _, n := range r.Nodes {
75 if n.Name == node {
76 switch n.Type {
77 case "ssh":
78 return NewSSHExecutor(n.Addr, n.User, WithIdentityFile(n.IdentityFile), WithPassword(n.Pass))
79 case "local", "":
80 return NewLocalExecutor()
81 case "docker":
82 log.Println("Use docker executor")
83 return DockerExecutor{
84 Image: n.Image,
85 Privileged: n.Privileged,
86 ExecUser: n.DockerExecUser,
87 RegistryPass: n.Pass,
88 RegistryUser: n.User,
89 }
90 default:
91 log.Fatal(fmt.Sprintf("Node type %s not found for node %s", n.Type, n.Name))
92 }
93 }
94 }
95
96 log.Fatal(fmt.Sprintf("Node %s not found", node))
97 return NewLocalExecutor()
98}
99
100func executeRetryInterval(t TestCase) {
101 if t.Command.GetRetries() > 1 && t.Command.Interval != "" {

Callers 2

RunMethod · 0.95
Test_getExecutorFunction · 0.95

Calls 4

NewSSHExecutorFunction · 0.85
WithIdentityFileFunction · 0.85
WithPasswordFunction · 0.85
NewLocalExecutorFunction · 0.85

Tested by 1

Test_getExecutorFunction · 0.76