summaryrefslogtreecommitdiff
path: root/pkg/adapter/client.go
diff options
context:
space:
mode:
authorAshley Cui <ashleycui16@gmail.com>2019-06-24 16:49:16 -0400
committerAshley Cui <ashleycui16@gmail.com>2019-06-25 16:10:42 -0400
commitbf5686739c5aebe64d8fdac8327cf71105694542 (patch)
treeebd113b38f976b41a7d79923ec7c9d1fd4fe26b7 /pkg/adapter/client.go
parent21978c99088c04bcc847eb12f829876708c0b9e2 (diff)
downloadpodman-bf5686739c5aebe64d8fdac8327cf71105694542.tar.gz
podman-bf5686739c5aebe64d8fdac8327cf71105694542.tar.bz2
podman-bf5686739c5aebe64d8fdac8327cf71105694542.zip
Fix crash for when remote host IP or Username is not set in conf file & conf file exists.
When Host IP is not set in podman-remote.conf, error is printed out. When Username is not set in podman-remote.conf, default username is used. Signed-off-by: Ashley Cui <ashleycui16@gmail.com>
Diffstat (limited to 'pkg/adapter/client.go')
-rw-r--r--pkg/adapter/client.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/pkg/adapter/client.go b/pkg/adapter/client.go
index 6feae5400..694d9f961 100644
--- a/pkg/adapter/client.go
+++ b/pkg/adapter/client.go
@@ -15,8 +15,10 @@ import (
var remoteEndpoint *Endpoint
func (r RemoteRuntime) RemoteEndpoint() (remoteEndpoint *Endpoint, err error) {
- remoteConfigConnections, _ := remoteclientconfig.ReadRemoteConfig(r.config)
-
+ remoteConfigConnections, err := remoteclientconfig.ReadRemoteConfig(r.config)
+ if errors.Cause(err) != remoteclientconfig.ErrNoConfigationFile {
+ return nil, err
+ }
// If the user defines an env variable for podman_varlink_bridge
// we use that as passed.
if bridge := os.Getenv("PODMAN_VARLINK_BRIDGE"); bridge != "" {
@@ -47,6 +49,10 @@ func (r RemoteRuntime) RemoteEndpoint() (remoteEndpoint *Endpoint, err error) {
if err != nil {
return nil, err
}
+ if len(rc.Username) < 1 {
+ logrus.Debugf("Connection has no username, using current user %q", r.cmd.RemoteUserName)
+ rc.Username = r.cmd.RemoteUserName
+ }
remoteEndpoint, err = newBridgeConnection("", rc, r.cmd.LogLevel)
// last resort is to make a socket connection with the default varlink address for root user
} else {