refactor
This commit is contained in:
parent
b7ad579d3b
commit
ecddc2fe21
@ -52,7 +52,7 @@ type Agent struct {
|
||||
EXE string
|
||||
SystemDrive string
|
||||
MeshInstaller string
|
||||
MeshSystemEXE string
|
||||
MeshSystemBin string
|
||||
MeshSVC string
|
||||
PyBin string
|
||||
Headers map[string]string
|
||||
@ -114,15 +114,15 @@ func New(logger *logrus.Logger, version string) *Agent {
|
||||
restyC.SetRootCertificate(ac.Cert)
|
||||
}
|
||||
|
||||
var MeshSysExe string
|
||||
var MeshSysBin string
|
||||
if len(ac.CustomMeshDir) > 0 {
|
||||
MeshSysExe = filepath.Join(ac.CustomMeshDir, "MeshAgent.exe")
|
||||
MeshSysBin = filepath.Join(ac.CustomMeshDir, "MeshAgent.exe")
|
||||
} else {
|
||||
MeshSysExe = filepath.Join(os.Getenv("ProgramFiles"), "Mesh Agent", "MeshAgent.exe")
|
||||
MeshSysBin = filepath.Join(os.Getenv("ProgramFiles"), "Mesh Agent", "MeshAgent.exe")
|
||||
}
|
||||
|
||||
if runtime.GOOS == "linux" {
|
||||
MeshSysExe = "/opt/tacticalmesh/meshagent"
|
||||
MeshSysBin = "/opt/tacticalmesh/meshagent"
|
||||
}
|
||||
|
||||
svcConf := &service.Config{
|
||||
@ -152,7 +152,7 @@ func New(logger *logrus.Logger, version string) *Agent {
|
||||
EXE: exe,
|
||||
SystemDrive: sd,
|
||||
MeshInstaller: "meshagent.exe",
|
||||
MeshSystemEXE: MeshSysExe,
|
||||
MeshSystemBin: MeshSysBin,
|
||||
MeshSVC: meshSvcName,
|
||||
PyBin: pybin,
|
||||
Headers: headers,
|
||||
|
@ -278,14 +278,14 @@ func (a *Agent) NixMeshNodeID() string {
|
||||
meshSuccess := false
|
||||
a.Logger.Debugln("Getting mesh node id")
|
||||
|
||||
if !trmm.FileExists(a.MeshSystemEXE) {
|
||||
a.Logger.Debugln(a.MeshSystemEXE, "does not exist. Skipping.")
|
||||
if !trmm.FileExists(a.MeshSystemBin) {
|
||||
a.Logger.Debugln(a.MeshSystemBin, "does not exist. Skipping.")
|
||||
return ""
|
||||
}
|
||||
|
||||
opts := a.NewCMDOpts()
|
||||
opts.IsExecutable = true
|
||||
opts.Shell = a.MeshSystemEXE
|
||||
opts.Shell = a.MeshSystemBin
|
||||
opts.Command = "-nodeid"
|
||||
|
||||
for !meshSuccess {
|
||||
|
@ -150,7 +150,7 @@ func (a *Agent) Install(i *Installer) {
|
||||
if len(i.MeshDir) > 0 {
|
||||
installerMeshSystemEXE = filepath.Join(i.MeshDir, "MeshAgent.exe")
|
||||
} else {
|
||||
installerMeshSystemEXE = a.MeshSystemEXE
|
||||
installerMeshSystemEXE = a.MeshSystemBin
|
||||
}
|
||||
|
||||
var meshNodeID string
|
||||
|
Loading…
Reference in New Issue
Block a user