[Agent] [Executor] 新增Systemd的部分

This commit is contained in:
zeaslity
2023-10-19 15:48:04 +08:00
parent 328247eeae
commit d9c1c0fb91
4 changed files with 133 additions and 14 deletions

View File

@@ -26,6 +26,14 @@ var shutdownFirewalld = []string{
"systemctl", "stop", "firewalld", "&&", "systemctl", "disable", "firewalld",
}
var wgetCommand = []string{
"wget",
"--timeout=10",
"https://oss-s1.107421.xyz/octopus_ssh_banner",
"-O",
"/home/wdd/IdeaProjects/ProjectOctopus/agent-go/executor/script/123",
}
var pipelineCommandFalse = []string{
"ls",
"/etc",
@@ -46,8 +54,9 @@ var pipelineCommand = [][]string{
}
var pipelineCommandMore = "apt-cache madison docker-ce | awk {print$3} | cut -d: -f2"
var pipelineCommandSecond = "systemctl status -q docker.service | grep found."
var pipelineCommandThird = "ls /etc/ | grep passwd | head -2"
var pipelineCommandSecond = "systemctl status docker.service | grep active | wc -w"
var pipelineCommandFourth = "echo dsadsad | tee /home/wdd/IdeaProjects/ProjectOctopus/agent-go/executor/script/123"
var ifconfigCommand = []string{"ifconfig"}
@@ -58,7 +67,7 @@ func TestReadTimeOutput(t *testing.T) {
}
func TestAllCommandExecutor(t *testing.T) {
ok, result := AllCommandExecutor(pipelineCommandFalse)
ok, result := AllCommandExecutor(wgetCommand)
t.Logf("执行结果为 => %#v", ok)
t.Logf("执行日志为 => %#v", result)
@@ -108,7 +117,7 @@ func TestPipelineCommandExecutorSingle(t *testing.T) {
func TestPipelineCommandExecutor(t *testing.T) {
//PipelineCommandExecutor(pipelineCommand)
pipelineStringToCommand := BasicTransPipelineCommand(pipelineCommandMore)
pipelineStringToCommand := BasicTransPipelineCommand(pipelineCommandSecond)
t.Logf("pipelineCommmand are => %#v", pipelineStringToCommand)