mirror of
https://github.com/containers/podman
synced 2024-10-21 01:34:37 +00:00
dc7ae31171
add the ability for the podman remote client to use a configuration file which describes its connections. users can now define a connection the configuration and then call it by name like: podman-remote -c connection1 and the destination and user will be derived from the configuration file. if no -c is provided, we look for a connection in the configuration file designated as 'default'. If the configuration file has only one connection, it will be deemed the 'default'. Signed-off-by: baude <bbaude@redhat.com>
31 lines
938 B
Go
31 lines
938 B
Go
// +build linux darwin
|
|
// +build remoteclient
|
|
|
|
package adapter
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/containers/libpod/cmd/podman/remoteclientconfig"
|
|
"github.com/pkg/errors"
|
|
)
|
|
|
|
// 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 = fmt.Sprintf(
|
|
`ssh -T %s@%s -- /usr/bin/varlink -A \'/usr/bin/podman --log-level=%s varlink \\\$VARLINK_ADDRESS\' bridge`,
|
|
remoteConn.Username, remoteConn.Destination, logLevel)
|
|
return &endpoint, nil
|
|
}
|