(dockerCLI command.Cli)
| 15 | ) |
| 16 | |
| 17 | func newUpgradeCommand(dockerCLI command.Cli) *cobra.Command { |
| 18 | var options pluginOptions |
| 19 | cmd := &cobra.Command{ |
| 20 | Use: "upgrade [OPTIONS] PLUGIN [REMOTE]", |
| 21 | Short: "Upgrade an existing plugin", |
| 22 | Args: cli.RequiresRangeArgs(1, 2), |
| 23 | RunE: func(cmd *cobra.Command, args []string) error { |
| 24 | options.localName = args[0] |
| 25 | if len(args) == 2 { |
| 26 | options.remote = args[1] |
| 27 | } |
| 28 | return runUpgrade(cmd.Context(), dockerCLI, options) |
| 29 | }, |
| 30 | Annotations: map[string]string{"version": "1.26"}, |
| 31 | ValidArgsFunction: completeNames(dockerCLI, stateAny), // TODO(thaJeztah): should only complete for the first arg |
| 32 | DisableFlagsInUseLine: true, |
| 33 | } |
| 34 | |
| 35 | flags := cmd.Flags() |
| 36 | flags.BoolVar(&options.grantPerms, "grant-all-permissions", false, "Grant all permissions necessary to run the plugin") |
| 37 | // TODO(thaJeztah): DEPRECATED: remove in v29.1 or v30 |
| 38 | flags.Bool("disable-content-trust", true, "Skip image verification (deprecated)") |
| 39 | _ = flags.MarkDeprecated("disable-content-trust", "support for docker content trust was removed") |
| 40 | flags.BoolVar(&options.skipRemoteCheck, "skip-remote-check", false, "Do not check if specified remote plugin matches existing plugin image") |
| 41 | return cmd |
| 42 | } |
| 43 | |
| 44 | func runUpgrade(ctx context.Context, dockerCLI command.Cli, opts pluginOptions) error { |
| 45 | res, err := dockerCLI.Client().PluginInspect(ctx, opts.localName, client.PluginInspectOptions{}) |
searching dependent graphs…