Plumb contexts through commands
This is to prepare for otel support. Signed-off-by: Brian Goff <cpuguy83@gmail.com> Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
committed by
Sebastiaan van Stijn
parent
9eb632dc7c
commit
5400a48aaf
@ -36,7 +36,7 @@ func newConnectCommand(dockerCli command.Cli) *cobra.Command {
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
options.network = args[0]
|
||||
options.container = args[1]
|
||||
return runConnect(dockerCli, options)
|
||||
return runConnect(cmd.Context(), dockerCli, options)
|
||||
},
|
||||
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
if len(args) == 0 {
|
||||
@ -57,7 +57,7 @@ func newConnectCommand(dockerCli command.Cli) *cobra.Command {
|
||||
return cmd
|
||||
}
|
||||
|
||||
func runConnect(dockerCli command.Cli, options connectOptions) error {
|
||||
func runConnect(ctx context.Context, dockerCli command.Cli, options connectOptions) error {
|
||||
client := dockerCli.Client()
|
||||
|
||||
driverOpts, err := convertDriverOpt(options.driverOpts)
|
||||
@ -75,7 +75,7 @@ func runConnect(dockerCli command.Cli, options connectOptions) error {
|
||||
DriverOpts: driverOpts,
|
||||
}
|
||||
|
||||
return client.NetworkConnect(context.Background(), options.network, options.container, epConfig)
|
||||
return client.NetworkConnect(ctx, options.network, options.container, epConfig)
|
||||
}
|
||||
|
||||
func convertDriverOpt(options []string) (map[string]string, error) {
|
||||
|
||||
Reference in New Issue
Block a user