Revert "fix: drop copy/pasta, keep timeouts"

This reverts commit a170e26e27.

Attempting to add more nuanced timeout logic.
This commit is contained in:
2021-11-02 15:18:17 +01:00
parent c76601c9ce
commit fc2deda1f6
4 changed files with 382 additions and 38 deletions

View File

@ -9,9 +9,7 @@ import (
context "github.com/docker/cli/cli/context"
"github.com/docker/cli/cli/context/docker"
contextStore "github.com/docker/cli/cli/context/store"
dCliContextStore "github.com/docker/cli/cli/context/store"
cliflags "github.com/docker/cli/cli/flags"
dClient "github.com/docker/docker/client"
"github.com/moby/term"
"github.com/sirupsen/logrus"
)
@ -127,30 +125,3 @@ func NewDefaultDockerContextStore() *command.ContextStoreWithDefault {
return dockerContextStore
}
func getDockerEndpointMetadataAndTLS(host string) (docker.EndpointMeta, *dCliContextStore.EndpointTLSData, error) {
ep, err := getDockerEndpoint(host)
if err != nil {
return docker.EndpointMeta{}, nil, err
}
return ep.EndpointMeta, ep.TLSData.ToStoreTLSData(), nil
}
func getDockerEndpoint(host string) (docker.Endpoint, error) {
skipTLSVerify := false
ep := docker.Endpoint{
EndpointMeta: docker.EndpointMeta{
Host: host,
SkipTLSVerify: skipTLSVerify,
},
}
// try to resolve a docker client, validating the configuration
opts, err := ep.ClientOpts()
if err != nil {
return docker.Endpoint{}, err
}
if _, err := dClient.NewClientWithOpts(opts...); err != nil {
return docker.Endpoint{}, err
}
return ep, nil
}