pkg/terminal: use c/storage/pkg/homedir

This also prunes the dependency on `k8s.io/client-go`.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
This commit is contained in:
Valentin Rothberg
2021-02-25 20:15:03 +01:00
parent b7c00f2cc0
commit 320df83881
6 changed files with 2 additions and 270 deletions

View File

@ -10,11 +10,11 @@ import (
"path/filepath"
"sync"
"github.com/containers/storage/pkg/homedir"
"github.com/sirupsen/logrus"
"golang.org/x/crypto/ssh"
"golang.org/x/crypto/ssh/knownhosts"
"golang.org/x/crypto/ssh/terminal"
"k8s.io/client-go/util/homedir"
)
var (
@ -105,7 +105,7 @@ func ReadLogin() []byte {
func HostKey(host string) ssh.PublicKey {
// parse OpenSSH known_hosts file
// ssh or use ssh-keyscan to get initial key
knownHosts := filepath.Join(homedir.HomeDir(), ".ssh", "known_hosts")
knownHosts := filepath.Join(homedir.Get(), ".ssh", "known_hosts")
fd, err := os.Open(knownHosts)
if err != nil {
logrus.Error(err)