From 31ec6dfa68202b97d092b2277e3f2201b00a4bf9 Mon Sep 17 00:00:00 2001 From: PatHoo Date: Wed, 22 Apr 2020 10:17:49 +0800 Subject: [PATCH] fix spelling mistakes --- install/download.go | 11 ++++++----- pkg/sshcmd/cmd/watch.go | 9 +++++---- pkg/sshcmd/sshutil/watch.go | 9 +++++---- ssh-mutual-trust.sh | 4 ++++ 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/install/download.go b/install/download.go index 20adb2424..e4c5e1234 100644 --- a/install/download.go +++ b/install/download.go @@ -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 diff --git a/pkg/sshcmd/cmd/watch.go b/pkg/sshcmd/cmd/watch.go index fa30a6d4d..ba4b6a2f5 100644 --- a/pkg/sshcmd/cmd/watch.go +++ b/pkg/sshcmd/cmd/watch.go @@ -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 { diff --git a/pkg/sshcmd/sshutil/watch.go b/pkg/sshcmd/sshutil/watch.go index 15c5a097c..48d87478e 100644 --- a/pkg/sshcmd/sshutil/watch.go +++ b/pkg/sshcmd/sshutil/watch.go @@ -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 { diff --git a/ssh-mutual-trust.sh b/ssh-mutual-trust.sh index d3c336d5f..e72ebd083 100755 --- a/ssh-mutual-trust.sh +++ b/ssh-mutual-trust.sh @@ -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