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 (
 | 
					import (
 | 
				
			||||||
	"errors"
 | 
						"errors"
 | 
				
			||||||
	"github.com/TeaOSLab/EdgeCommon/pkg/configutils"
 | 
						"github.com/TeaOSLab/EdgeCommon/pkg/configutils"
 | 
				
			||||||
 | 
						"github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs"
 | 
				
			||||||
	"github.com/iwind/TeaGo/Tea"
 | 
						"github.com/iwind/TeaGo/Tea"
 | 
				
			||||||
	stringutil "github.com/iwind/TeaGo/utils/string"
 | 
						stringutil "github.com/iwind/TeaGo/utils/string"
 | 
				
			||||||
	"golang.org/x/crypto/ssh"
 | 
						"golang.org/x/crypto/ssh"
 | 
				
			||||||
@@ -133,7 +134,7 @@ func (this *BaseInstaller) LookupLatestInstaller(filePrefix string) (string, err
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// InstallHelper 上传安装助手
 | 
					// 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")
 | 
						uname, _, err := this.client.Exec("uname -a")
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return env, err
 | 
							return env, err
 | 
				
			||||||
@@ -164,7 +165,11 @@ func (this *BaseInstaller) InstallHelper(targetDir string) (env *Env, err error)
 | 
				
			|||||||
		archName = "386"
 | 
							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
 | 
						exePath := Tea.Root + "/installers/" + exeName
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err = this.client.Copy(exePath, targetDir+"/"+exeName, 0777)
 | 
						err = this.client.Copy(exePath, targetDir+"/"+exeName, 0777)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,6 +4,7 @@ import (
 | 
				
			|||||||
	"bytes"
 | 
						"bytes"
 | 
				
			||||||
	"errors"
 | 
						"errors"
 | 
				
			||||||
	"github.com/TeaOSLab/EdgeAPI/internal/db/models"
 | 
						"github.com/TeaOSLab/EdgeAPI/internal/db/models"
 | 
				
			||||||
 | 
						"github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs"
 | 
				
			||||||
	"path/filepath"
 | 
						"path/filepath"
 | 
				
			||||||
	"regexp"
 | 
						"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 {
 | 
						if err != nil {
 | 
				
			||||||
		installStatus.ErrorCode = "INSTALL_HELPER_FAILED"
 | 
							installStatus.ErrorCode = "INSTALL_HELPER_FAILED"
 | 
				
			||||||
		return err
 | 
							return err
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,6 +4,7 @@ import (
 | 
				
			|||||||
	"bytes"
 | 
						"bytes"
 | 
				
			||||||
	"errors"
 | 
						"errors"
 | 
				
			||||||
	"github.com/TeaOSLab/EdgeAPI/internal/db/models"
 | 
						"github.com/TeaOSLab/EdgeAPI/internal/db/models"
 | 
				
			||||||
 | 
						"github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs"
 | 
				
			||||||
	"path/filepath"
 | 
						"path/filepath"
 | 
				
			||||||
	"regexp"
 | 
						"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 {
 | 
						if err != nil {
 | 
				
			||||||
		installStatus.ErrorCode = "INSTALL_HELPER_FAILED"
 | 
							installStatus.ErrorCode = "INSTALL_HELPER_FAILED"
 | 
				
			||||||
		return err
 | 
							return err
 | 
				
			||||||
 
 | 
				
			|||||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
		Reference in New Issue
	
	Block a user