Skip to content

Commit c03ffa5

Browse files
authored
Merge pull request #12672 from marcvelasco/mvelasc-patch-2
fix for #12659, utilize absolute path when tilde starts ssh-key path
2 parents b405bf6 + a48e875 commit c03ffa5

File tree

1 file changed

+14
-1
lines changed
  • pkg/minikube/registry/drvs/ssh

1 file changed

+14
-1
lines changed

pkg/minikube/registry/drvs/ssh/ssh.go

+14-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ package ssh
1818

1919
import (
2020
"fmt"
21+
"os"
22+
"path/filepath"
23+
"strings"
2124

2225
"github.com/docker/machine/libmachine/drivers"
2326
"github.com/pkg/errors"
@@ -63,7 +66,17 @@ func configure(cc config.ClusterConfig, n config.Node) (interface{}, error) {
6366

6467
d.IPAddress = cc.SSHIPAddress
6568
d.SSHUser = cc.SSHUser
66-
d.SSHKey = cc.SSHKey
69+
70+
if strings.HasPrefix(cc.SSHKey, "~") {
71+
dirname, err := os.UserHomeDir()
72+
if err != nil {
73+
return nil, errors.Errorf("Error determining path to ssh key: %v", err)
74+
}
75+
d.SSHKey = filepath.Join(dirname, cc.SSHKey[1:])
76+
} else {
77+
d.SSHKey = cc.SSHKey
78+
}
79+
6780
d.SSHPort = cc.SSHPort
6881

6982
return d, nil

0 commit comments

Comments
 (0)