Skip to content

Commit

Permalink
Merge pull request #12672 from marcvelasco/mvelasc-patch-2
Browse files Browse the repository at this point in the history
fix for #12659, utilize absolute path when tilde starts ssh-key path
  • Loading branch information
spowelljr authored Oct 7, 2021
2 parents b405bf6 + a48e875 commit c03ffa5
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion pkg/minikube/registry/drvs/ssh/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ package ssh

import (
"fmt"
"os"
"path/filepath"
"strings"

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

d.IPAddress = cc.SSHIPAddress
d.SSHUser = cc.SSHUser
d.SSHKey = cc.SSHKey

if strings.HasPrefix(cc.SSHKey, "~") {
dirname, err := os.UserHomeDir()
if err != nil {
return nil, errors.Errorf("Error determining path to ssh key: %v", err)
}
d.SSHKey = filepath.Join(dirname, cc.SSHKey[1:])
} else {
d.SSHKey = cc.SSHKey
}

d.SSHPort = cc.SSHPort

return d, nil
Expand Down

0 comments on commit c03ffa5

Please sign in to comment.