Skip to content

Commit

Permalink
fix(v1.0): fix md5
Browse files Browse the repository at this point in the history
  • Loading branch information
cuisongliu committed Mar 17, 2020
1 parent 81d16b6 commit bfb1f5a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/sshutil/connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"golang.org/x/crypto/ssh"
"io/ioutil"
"net"
"os"
"strings"
"time"
)
Expand Down Expand Up @@ -59,7 +60,11 @@ func (ss *SSH) sshAuthMethod(passwd, pkFile string) ssh.AuthMethod {
am = ssh.Password(passwd)
} else {
pkData := ss.readFile(pkFile)
pk, _ := ssh.ParsePrivateKey([]byte(pkData))
pk, err := ssh.ParsePrivateKey([]byte(pkData))
if err != nil {
logger.Error(err)
os.Exit(1)
}
am = ssh.PublicKeys(pk)
}
return am
Expand All @@ -69,7 +74,7 @@ func (ss *SSH) readFile(name string) string {
content, err := ioutil.ReadFile(name)
if err != nil {
logger.Error("[globals] read file err is : %s", err)
return ""
os.Exit(1)
}
return string(content)
}
Expand Down

0 comments on commit bfb1f5a

Please sign in to comment.