mirror of
				https://github.com/TeaOSLab/EdgeAPI.git
				synced 2025-11-04 16:00:24 +08:00 
			
		
		
		
	修复边缘节点和DNS节点安装文件冲突的问题
This commit is contained in:
		@@ -3,6 +3,7 @@ package installers
 | 
			
		||||
import (
 | 
			
		||||
	"errors"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeCommon/pkg/configutils"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs"
 | 
			
		||||
	"github.com/iwind/TeaGo/Tea"
 | 
			
		||||
	stringutil "github.com/iwind/TeaGo/utils/string"
 | 
			
		||||
	"golang.org/x/crypto/ssh"
 | 
			
		||||
@@ -133,7 +134,7 @@ func (this *BaseInstaller) LookupLatestInstaller(filePrefix string) (string, err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// InstallHelper 上传安装助手
 | 
			
		||||
func (this *BaseInstaller) InstallHelper(targetDir string) (env *Env, err error) {
 | 
			
		||||
func (this *BaseInstaller) InstallHelper(targetDir string, role nodeconfigs.NodeRole) (env *Env, err error) {
 | 
			
		||||
	uname, _, err := this.client.Exec("uname -a")
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return env, err
 | 
			
		||||
@@ -164,7 +165,11 @@ func (this *BaseInstaller) InstallHelper(targetDir string) (env *Env, err error)
 | 
			
		||||
		archName = "386"
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	exeName := "edge-installer-dns-helper-" + osName + "-" + archName
 | 
			
		||||
	exeName := "edge-installer-helper-" + osName + "-" + archName
 | 
			
		||||
	switch role {
 | 
			
		||||
	case nodeconfigs.NodeRoleDNS:
 | 
			
		||||
		exeName = "edge-installer-dns-helper-" + osName + "-" + archName
 | 
			
		||||
	}
 | 
			
		||||
	exePath := Tea.Root + "/installers/" + exeName
 | 
			
		||||
 | 
			
		||||
	err = this.client.Copy(exePath, targetDir+"/"+exeName, 0777)
 | 
			
		||||
 
 | 
			
		||||
@@ -4,6 +4,7 @@ import (
 | 
			
		||||
	"bytes"
 | 
			
		||||
	"errors"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAPI/internal/db/models"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs"
 | 
			
		||||
	"path/filepath"
 | 
			
		||||
	"regexp"
 | 
			
		||||
)
 | 
			
		||||
@@ -36,7 +37,7 @@ func (this *NodeInstaller) Install(dir string, params interface{}, installStatus
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// 安装助手
 | 
			
		||||
	env, err := this.InstallHelper(dir)
 | 
			
		||||
	env, err := this.InstallHelper(dir, nodeconfigs.NodeRoleNode)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		installStatus.ErrorCode = "INSTALL_HELPER_FAILED"
 | 
			
		||||
		return err
 | 
			
		||||
 
 | 
			
		||||
@@ -4,6 +4,7 @@ import (
 | 
			
		||||
	"bytes"
 | 
			
		||||
	"errors"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAPI/internal/db/models"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs"
 | 
			
		||||
	"path/filepath"
 | 
			
		||||
	"regexp"
 | 
			
		||||
)
 | 
			
		||||
@@ -36,7 +37,7 @@ func (this *NSNodeInstaller) Install(dir string, params interface{}, installStat
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// 安装助手
 | 
			
		||||
	env, err := this.InstallHelper(dir)
 | 
			
		||||
	env, err := this.InstallHelper(dir, nodeconfigs.NodeRoleDNS)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		installStatus.ErrorCode = "INSTALL_HELPER_FAILED"
 | 
			
		||||
		return err
 | 
			
		||||
 
 | 
			
		||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
		Reference in New Issue
	
	Block a user