[agent-go] [Bastion] - install docker; docker-compose; install harbor

This commit is contained in:
zeaslity
2024-04-18 09:46:26 +08:00
parent dacdb6588e
commit abe83b68e9
10 changed files with 554 additions and 99 deletions

View File

@@ -578,6 +578,14 @@ func BasicDownloadFile(downloadUrl string, socksProxyUrl string, proxyUser strin
return false, resultLog
}
// check file exists
existAndNotNull := BasicFileExistAndNotNull(desFile)
if !existAndNotNull {
return false, []string{
"[BasicDownloadFile] - file not exist download error!",
}
}
return true, resultLog
}
@@ -724,6 +732,17 @@ func BasicAppendContentToFile(content string, targetFile string) bool {
return true
}
// BasicAppendOverwriteContentToFile 向目标文件中写入一些内容,覆盖源文件
func BasicAppendOverwriteContentToFile(content string, targetFile string) bool {
err := os.Remove(targetFile)
if err != nil {
log.WarnF("[BasicAppendOverwriteContentToFile] - Error removing file: %s , error is %s", targetFile, err.Error())
}
return BasicAppendContentToFile(content, targetFile)
}
// BasicAppendNullToFile 清空一个文件
func BasicAppendNullToFile(targetFile string) bool {