updated tests and methods
This commit is contained in:
parent
de8e795254
commit
da1e250ce9
8 changed files with 94 additions and 40 deletions
16
agent/tactical/shared/shared_test.go
Normal file
16
agent/tactical/shared/shared_test.go
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
package shared_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/amidaware/rmmagent/agent/tactical/shared"
|
||||
)
|
||||
|
||||
func TestGetPythonBin(t *testing.T) {
|
||||
pybin := shared.GetPythonBin()
|
||||
if pybin == "" {
|
||||
t.Errorf("expected path, got %s", pybin)
|
||||
}
|
||||
|
||||
t.Logf("result: %s", pybin)
|
||||
}
|
||||
|
|
@ -3,6 +3,34 @@
|
|||
|
||||
package shared
|
||||
|
||||
import (
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const (
|
||||
binName = "tacticalagent"
|
||||
)
|
||||
|
||||
func GetPython(force bool) {}
|
||||
|
||||
func RunMigrations() {}
|
||||
func RunMigrations() {}
|
||||
|
||||
func GetPythonBin() string {
|
||||
pybin, err := exec.Command("python", "-c", "import sys; print(sys.executable)").Output()
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
|
||||
return strings.TrimSuffix(string(pybin), "\n")
|
||||
}
|
||||
|
||||
func GetProgramDirectory() string {
|
||||
return "/usr/local/bin"
|
||||
}
|
||||
|
||||
func GetProgramBin() string {
|
||||
bin := filepath.Join(GetProgramDirectory(), binName)
|
||||
return bin
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue