Merge pull request #3386 from baude/windowsbridge

add windows bridge format
This commit is contained in:
OpenShift Merge Robot
2019-06-21 14:36:55 +02:00
committed by GitHub
3 changed files with 25 additions and 22 deletions

View File

@ -91,3 +91,20 @@ func newSocketConnection(address string) (*Endpoint, error) {
} }
return &endpoint, nil return &endpoint, nil
} }
// newBridgeConnection creates a bridge type endpoint with username, destination, and log-level
func newBridgeConnection(formattedBridge string, remoteConn *remoteclientconfig.RemoteConnection, logLevel string) (*Endpoint, error) {
endpoint := Endpoint{
Type: BridgeConnection,
}
if len(formattedBridge) < 1 && remoteConn == nil {
return nil, errors.New("bridge connections must either be created by string or remoteconnection")
}
if len(formattedBridge) > 0 {
endpoint.Connection = formattedBridge
return &endpoint, nil
}
endpoint.Connection = formatDefaultBridge(remoteConn, logLevel)
return &endpoint, nil
}

View File

@ -7,24 +7,10 @@ import (
"fmt" "fmt"
"github.com/containers/libpod/cmd/podman/remoteclientconfig" "github.com/containers/libpod/cmd/podman/remoteclientconfig"
"github.com/pkg/errors"
) )
// newBridgeConnection creates a bridge type endpoint with username, destination, and log-level func formatDefaultBridge(remoteConn *remoteclientconfig.RemoteConnection, logLevel string) string {
func newBridgeConnection(formattedBridge string, remoteConn *remoteclientconfig.RemoteConnection, logLevel string) (*Endpoint, error) { return fmt.Sprintf(
endpoint := Endpoint{
Type: BridgeConnection,
}
if len(formattedBridge) < 1 && remoteConn == nil {
return nil, errors.New("bridge connections must either be created by string or remoteconnection")
}
if len(formattedBridge) > 0 {
endpoint.Connection = formattedBridge
return &endpoint, nil
}
endpoint.Connection = fmt.Sprintf(
`ssh -T %s@%s -- /usr/bin/varlink -A \'/usr/bin/podman --log-level=%s varlink \\\$VARLINK_ADDRESS\' bridge`, `ssh -T %s@%s -- /usr/bin/varlink -A \'/usr/bin/podman --log-level=%s varlink \\\$VARLINK_ADDRESS\' bridge`,
remoteConn.Username, remoteConn.Destination, logLevel) remoteConn.Username, remoteConn.Destination, logLevel)
return &endpoint, nil
} }

View File

@ -3,13 +3,13 @@
package adapter package adapter
import ( import (
"fmt"
"github.com/containers/libpod/cmd/podman/remoteclientconfig" "github.com/containers/libpod/cmd/podman/remoteclientconfig"
"github.com/containers/libpod/libpod"
) )
func newBridgeConnection(formattedBridge string, remoteConn *remoteclientconfig.RemoteConnection, logLevel string) (*Endpoint, error) { func formatDefaultBridge(remoteConn *remoteclientconfig.RemoteConnection, logLevel string) string {
// TODO return fmt.Sprintf(
// Unix and Windows appear to quote their ssh implementations differently therefore once we figure out what `ssh -T %s@%s -- /usr/bin/varlink -A '/usr/bin/podman --log-level=%s varlink $VARLINK_ADDRESS' bridge`,
// windows ssh is doing here, we can then get the format correct. remoteConn.Username, remoteConn.Destination, logLevel)
return nil, libpod.ErrNotImplemented
} }