修复边缘节点和DNS节点安装文件冲突的问题

This commit is contained in:
GoEdgeLab
2021-08-11 21:14:01 +08:00
parent 6460489a91
commit f66eef28eb
4 changed files with 12 additions and 5 deletions

View File

@@ -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)

View File

@@ -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

View File

@@ -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