修改bastion的bug
This commit is contained in:
@@ -947,11 +947,11 @@ func (op *AgentOsOperator) InstallDockerBastion() (bool, []string) {
|
|||||||
|
|
||||||
dockerLocalFile := filepath.Join(OctopusAgentInstallPrefix, dockerOfflineFileName)
|
dockerLocalFile := filepath.Join(OctopusAgentInstallPrefix, dockerOfflineFileName)
|
||||||
|
|
||||||
// 下载
|
// 下载 非常错误 bastion 不能去下载 可恶
|
||||||
if op.CanAccessInternet {
|
// if op.CanAccessInternet {
|
||||||
log.Info("[InstallDockerBastion] - start to download docker offline file!")
|
// log.Info("[InstallDockerBastion] - start to download docker offline file!")
|
||||||
BasicDownloadFile(op.OssOfflinePrefix+dockerOfflineFileName, "", "", "", dockerLocalFile)
|
// BasicDownloadFile(op.OssOfflinePrefix+dockerOfflineFileName, "", "", "", dockerLocalFile)
|
||||||
}
|
// }
|
||||||
|
|
||||||
if !BasicFileExistAndNotNull(dockerLocalFile) {
|
if !BasicFileExistAndNotNull(dockerLocalFile) {
|
||||||
sprintf := fmt.Sprintf("docker offline file not exists ! => %s", dockerLocalFile)
|
sprintf := fmt.Sprintf("docker offline file not exists ! => %s", dockerLocalFile)
|
||||||
|
|||||||
@@ -423,15 +423,26 @@ func BasicFileExists(filename string) bool {
|
|||||||
// BasicFileExistAndNotNull 文件不为空返回true 文件为空返回false
|
// BasicFileExistAndNotNull 文件不为空返回true 文件为空返回false
|
||||||
func BasicFileExistAndNotNull(filename string) bool {
|
func BasicFileExistAndNotNull(filename string) bool {
|
||||||
|
|
||||||
// 获取文件信息
|
// Check if the file exists
|
||||||
fileInfo, err := os.Stat(filename)
|
if _, err := os.Stat(filename); os.IsNotExist(err) {
|
||||||
if err != nil {
|
log.DebugF("文件 %s 不存在!", filename)
|
||||||
// 如果文件不存在或其他错误,返回 false
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查文件大小是否大于零
|
// Open the file for reading
|
||||||
return fileInfo.Size() > 0
|
file, err := os.Open(filename)
|
||||||
|
defer file.Close()
|
||||||
|
if err != nil {
|
||||||
|
log.DebugF("文件 %s 打开有误!", filename)
|
||||||
|
return false // Handle error according to your needs
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the file size
|
||||||
|
info, _ := file.Stat()
|
||||||
|
size := info.Size()
|
||||||
|
|
||||||
|
// Check if the file is not empty
|
||||||
|
return size > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func BasicFolderExists(folderName string) bool {
|
func BasicFolderExists(folderName string) bool {
|
||||||
|
|||||||
Reference in New Issue
Block a user