MCPcopy Index your code
hub / github.com/coder/coder / syncComplete

Method syncComplete

cli/sync_complete.go:12–47  ·  view source on GitHub ↗
(socketPath *string)

Source from the content-addressed store, hash-verified

10)
11
12func (*RootCmd) syncComplete(socketPath *string) *serpent.Command {
13 cmd := &serpent.Command{
14 Use: "complete <unit>",
15 Short: "Mark a unit as complete",
16 Long: "Mark a unit as complete. Indicating to other units that it has completed its work. This allows units that depend on it to proceed with their startup.",
17 Handler: func(i *serpent.Invocation) error {
18 ctx := i.Context()
19
20 if len(i.Args) != 1 {
21 return xerrors.New("exactly one unit name is required")
22 }
23 unit := unit.ID(i.Args[0])
24
25 opts := []agentsocket.Option{}
26 if *socketPath != "" {
27 opts = append(opts, agentsocket.WithPath(*socketPath))
28 }
29
30 client, err := agentsocket.NewClient(ctx, opts...)
31 if err != nil {
32 return xerrors.Errorf("connect to agent socket: %w", err)
33 }
34 defer client.Close()
35
36 if err := client.SyncComplete(ctx, unit); err != nil {
37 return xerrors.Errorf("complete unit failed: %w", err)
38 }
39
40 cliui.Info(i.Stdout, "Success")
41
42 return nil
43 },
44 }
45
46 return cmd
47}

Callers 1

syncCommandMethod · 0.95

Calls 9

CloseMethod · 0.95
SyncCompleteMethod · 0.95
IDTypeAlias · 0.92
WithPathFunction · 0.92
NewClientFunction · 0.92
InfoFunction · 0.92
ContextMethod · 0.65
NewMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected