Skip to content

Commit e09e6da

Browse files
committed
Plumb context to API callbacks
Signatures of these functions were changed in 80d92fd45007b6395dc2db5f93def3b159dacd7f Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
1 parent 23c2fa2 commit e09e6da

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

cli/command/plugin/install.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,12 @@ func runInstall(ctx context.Context, dockerCli command.Cli, opts pluginOptions)
136136
return nil
137137
}
138138

139-
func acceptPrivileges(dockerCli command.Cli, name string) func(privileges types.PluginPrivileges) (bool, error) {
140-
return func(privileges types.PluginPrivileges) (bool, error) {
139+
func acceptPrivileges(dockerCli command.Cli, name string) func(ctx context.Context, privileges types.PluginPrivileges) (bool, error) {
140+
return func(ctx context.Context, privileges types.PluginPrivileges) (bool, error) {
141141
fmt.Fprintf(dockerCli.Out(), "Plugin %q is requesting the following privileges:\n", name)
142142
for _, privilege := range privileges {
143143
fmt.Fprintf(dockerCli.Out(), " - %s: %v\n", privilege.Name, privilege.Value)
144144
}
145-
ctx := context.TODO()
146145
return command.PromptForConfirmation(ctx, dockerCli.In(), dockerCli.Out(), "Do you grant the above permissions?")
147146
}
148147
}

cli/command/registry.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package command
22

33
import (
44
"bufio"
5+
"context"
56
"fmt"
67
"io"
78
"os"
@@ -27,7 +28,7 @@ const patSuggest = "You can log in with your password or a Personal Access " +
2728
// RegistryAuthenticationPrivilegedFunc returns a RequestPrivilegeFunc from the specified registry index info
2829
// for the given command.
2930
func RegistryAuthenticationPrivilegedFunc(cli Cli, index *registrytypes.IndexInfo, cmdName string) types.RequestPrivilegeFunc {
30-
return func() (string, error) {
31+
return func(_ context.Context) (string, error) {
3132
fmt.Fprintf(cli.Out(), "\nPlease login prior to %s:\n", cmdName)
3233
indexServer := registry.GetAuthConfigKey(index)
3334
isDefaultRegistry := indexServer == registry.IndexServer

0 commit comments

Comments
 (0)