(ctx context.Context, dockerCLI command.Cli, opts pluginOptions)
| 77 | } |
| 78 | |
| 79 | func runInstall(ctx context.Context, dockerCLI command.Cli, opts pluginOptions) error { |
| 80 | var localName string |
| 81 | if opts.localName != "" { |
| 82 | aref, err := reference.ParseNormalizedNamed(opts.localName) |
| 83 | if err != nil { |
| 84 | return err |
| 85 | } |
| 86 | if _, ok := aref.(reference.Canonical); ok { |
| 87 | return fmt.Errorf("invalid name: %s", opts.localName) |
| 88 | } |
| 89 | localName = reference.FamiliarString(reference.TagNameOnly(aref)) |
| 90 | } |
| 91 | |
| 92 | options, err := buildPullConfig(dockerCLI, opts) |
| 93 | if err != nil { |
| 94 | return err |
| 95 | } |
| 96 | responseBody, err := dockerCLI.Client().PluginInstall(ctx, localName, options) |
| 97 | if err != nil { |
| 98 | return err |
| 99 | } |
| 100 | defer func() { |
| 101 | _ = responseBody.Close() |
| 102 | }() |
| 103 | if err := jsonstream.Display(ctx, responseBody, dockerCLI.Out()); err != nil { |
| 104 | return err |
| 105 | } |
| 106 | _, _ = fmt.Fprintln(dockerCLI.Out(), "Installed plugin", opts.remote) // todo: return proper values from the API for this result |
| 107 | return nil |
| 108 | } |
| 109 | |
| 110 | func acceptPrivileges(dockerCLI command.Streams, name string) func(ctx context.Context, privileges plugin.Privileges) (bool, error) { |
| 111 | return func(ctx context.Context, privileges plugin.Privileges) (bool, error) { |
no test coverage detected
searching dependent graphs…