MCPcopy Index your code
hub / github.com/docker/cli / runDemote

Function runDemote

cli/command/node/demote.go:26–38  ·  view source on GitHub ↗
(ctx context.Context, dockerCLI command.Cli, nodes []string)

Source from the content-addressed store, hash-verified

24}
25
26func runDemote(ctx context.Context, dockerCLI command.Cli, nodes []string) error {
27 demote := func(node *swarm.Node) error {
28 if node.Spec.Role == swarm.NodeRoleWorker {
29 _, _ = fmt.Fprintf(dockerCLI.Out(), "Node %s is already a worker.\n", node.ID)
30 return errNoRoleChange
31 }
32 node.Spec.Role = swarm.NodeRoleWorker
33 return nil
34 }
35 return updateNodes(ctx, dockerCLI.Client(), nodes, demote, func(nodeID string) {
36 _, _ = fmt.Fprintf(dockerCLI.Out(), "Manager %s demoted in the swarm.\n", nodeID)
37 })
38}

Callers 1

newDemoteCommandFunction · 0.85

Calls 3

updateNodesFunction · 0.85
OutMethod · 0.65
ClientMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…