fix spelling mistakes

This commit is contained in:
PatHoo
2020-04-22 10:17:49 +08:00
parent 2cf2bc42dc
commit 31ec6dfa68
4 changed files with 20 additions and 13 deletions
+6 -5
View File
@@ -2,12 +2,13 @@ package install
import (
"fmt"
"github.com/fanux/sealos/pkg/sshcmd/cmd"
"github.com/fanux/sealos/pkg/sshcmd/md5sum"
"github.com/wonderivan/logger"
"net/url"
"path"
"sync"
"github.com/fanux/sealos/pkg/sshcmd/cmd"
"github.com/fanux/sealos/pkg/sshcmd/md5sum"
"github.com/wonderivan/logger"
)
//location : url
@@ -30,7 +31,7 @@ func SendPackage(location string, hosts []string, dst string, before, after *str
logger.Debug("[%s]please wait for before hook", host)
_ = SSHConfig.CmdAsync(host, *before)
}
if SSHConfig.IsFilExist(host, fullPath) {
if SSHConfig.IsFileExist(host, fullPath) {
logger.Warn("[%s]SendPackage: file is exist", host)
} else {
if ok := SSHConfig.CopyForMD5(host, location, fullPath, md5); ok {
@@ -53,7 +54,7 @@ func SendPackage(location string, hosts []string, dst string, before, after *str
func downloadFile(location string) (filePATH, md5 string) {
if _, isUrl := isUrl(location); isUrl {
absPATH := "/tmp/sealos/" + path.Base(location)
if !cmd.IsFilExist(absPATH) {
if !cmd.IsFileExist(absPATH) {
//generator download cmd
dwnCmd := downloadCmd(location)
//os exec download command
+5 -4
View File
@@ -2,11 +2,12 @@ package cmd
import (
"fmt"
"github.com/wonderivan/logger"
"path"
"strconv"
"strings"
"time"
"github.com/wonderivan/logger"
)
const oneMBByte = 1024 * 1024
@@ -32,8 +33,8 @@ func LoggerFileSize(filename string, size int) {
}
}
//RemoteFilExist is
func IsFilExist(filepath string) bool {
//RemoteFileExist is
func IsFileExist(filepath string) bool {
// if remote file is
// ls -l | grep aa | wc -l
fileName := path.Base(filepath) // aa
@@ -44,7 +45,7 @@ func IsFilExist(filepath string) bool {
count, err := strconv.Atoi(strings.TrimSpace(data))
defer func() {
if r := recover(); r != nil {
logger.Error("[os][%s]RemoteFilExist:%s", filepath, err)
logger.Error("[os][%s]RemoteFileExist:%s", filepath, err)
}
}()
if err != nil {
+5 -4
View File
@@ -2,11 +2,12 @@ package sshutil
import (
"fmt"
"github.com/wonderivan/logger"
"path"
"strconv"
"strings"
"time"
"github.com/wonderivan/logger"
)
const oneMBByte = 1024 * 1024
@@ -32,8 +33,8 @@ func (ss *SSH) LoggerFileSize(host, filename string, size int) {
}
}
//RemoteFilExist is
func (ss *SSH) IsFilExist(host, remoteFilePath string) bool {
//RemoteFileExist is
func (ss *SSH) IsFileExist(host, remoteFilePath string) bool {
// if remote file is
// ls -l | grep aa | wc -l
remoteFileName := path.Base(remoteFilePath) // aa
@@ -46,7 +47,7 @@ func (ss *SSH) IsFilExist(host, remoteFilePath string) bool {
count, err := strconv.Atoi(strings.TrimSpace(data))
defer func() {
if r := recover(); r != nil {
logger.Error("[ssh][%s]RemoteFilExist:%s", host, err)
logger.Error("[ssh][%s]RemoteFileExist:%s", host, err)
}
}()
if err != nil {
+4
View File
@@ -6,6 +6,8 @@
#
#或者用户密码写在命令行:
#./ssh-mutual-trust.sh hosts_file root Abc123
#
#执行脚本的机器要安装 expect 软件包
# check args count
if test $# -lt 1; then
@@ -18,6 +20,8 @@ fi
#password=${!#}
hosts_file=$1
username=$2
password=$3
if test X$2 == X""; then
username=root