forked from toolshed/abra
refactor!: drop all SSH opts / config handling
See coop-cloud/organising#601 See coop-cloud/organising#482
This commit is contained in:
@ -16,12 +16,12 @@ import (
|
||||
// GetConnectionHelper returns Docker-specific connection helper for the given URL.
|
||||
// GetConnectionHelper returns nil without error when no helper is registered for the scheme.
|
||||
//
|
||||
// ssh://<user>@<host> URL requires Docker 18.09 or later on the remote host.
|
||||
// ssh://<host> URL requires Docker 18.09 or later on the remote host.
|
||||
func GetConnectionHelper(daemonURL string) (*connhelper.ConnectionHelper, error) {
|
||||
return getConnectionHelper(daemonURL, []string{"-o ConnectTimeout=60"})
|
||||
return getConnectionHelper(daemonURL)
|
||||
}
|
||||
|
||||
func getConnectionHelper(daemonURL string, sshFlags []string) (*connhelper.ConnectionHelper, error) {
|
||||
func getConnectionHelper(daemonURL string) (*connhelper.ConnectionHelper, error) {
|
||||
url, err := url.Parse(daemonURL)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -35,7 +35,7 @@ func getConnectionHelper(daemonURL string, sshFlags []string) (*connhelper.Conne
|
||||
|
||||
return &connhelper.ConnectionHelper{
|
||||
Dialer: func(ctx context.Context, network, addr string) (net.Conn, error) {
|
||||
return New(ctx, "ssh", append(sshFlags, ctxConnDetails.Args("docker", "system", "dial-stdio")...)...)
|
||||
return New(ctx, "ssh", ctxConnDetails.Args("docker", "system", "dial-stdio")...)
|
||||
},
|
||||
Host: "http://docker.example.com",
|
||||
}, nil
|
||||
@ -45,6 +45,7 @@ func getConnectionHelper(daemonURL string, sshFlags []string) (*connhelper.Conne
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// NewConnectionHelper creates new connection helper for a remote docker daemon.
|
||||
func NewConnectionHelper(daemonURL string) (*connhelper.ConnectionHelper, error) {
|
||||
helper, err := GetConnectionHelper(daemonURL)
|
||||
if err != nil {
|
||||
@ -73,6 +74,7 @@ func getDockerEndpoint(host string) (docker.Endpoint, error) {
|
||||
return ep, nil
|
||||
}
|
||||
|
||||
// GetDockerEndpointMetadataAndTLS retrieves the docker endpoint and TLS info for a remote host.
|
||||
func GetDockerEndpointMetadataAndTLS(host string) (docker.EndpointMeta, *dCliContextStore.EndpointTLSData, error) {
|
||||
ep, err := getDockerEndpoint(host)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user