MCPcopy Create free account
hub / github.com/containerd/nerdctl / updateAction

Function updateAction

cmd/nerdctl/container/container_update.go:94–120  ·  view source on GitHub ↗
(cmd *cobra.Command, args []string)

Source from the content-addressed store, hash-verified

92}
93
94func updateAction(cmd *cobra.Command, args []string) error {
95 globalOptions, err := helpers.ProcessRootCmdFlags(cmd)
96 if err != nil {
97 return err
98 }
99 client, ctx, cancel, err := clientutil.NewClient(cmd.Context(), globalOptions.Namespace, globalOptions.Address)
100 if err != nil {
101 return err
102 }
103 defer cancel()
104 options, err := getUpdateOption(cmd, globalOptions)
105 if err != nil {
106 return err
107 }
108 walker := &containerwalker.ContainerWalker{
109 Client: client,
110 OnFound: func(ctx context.Context, found containerwalker.Found) error {
111 if found.MatchCount > 1 {
112 return fmt.Errorf("multiple IDs found with provided prefix: %s", found.Req)
113 }
114 err = updateContainer(ctx, client, found.Container.ID(), options, cmd)
115 return err
116 },
117 }
118
119 return walker.WalkAll(ctx, args, true)
120}
121
122func getUpdateOption(cmd *cobra.Command, globalOptions types.GlobalCommandOptions) (updateResourceOptions, error) {
123 var options updateResourceOptions

Callers

nothing calls this directly

Calls 5

WalkAllMethod · 0.95
ProcessRootCmdFlagsFunction · 0.92
NewClientFunction · 0.92
getUpdateOptionFunction · 0.85
updateContainerFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…