diff --git a/cmd/server/app/network/controller/agentcontroller/script.go b/cmd/server/app/network/controller/agentcontroller/script.go index 7234e10d30b43c2297f6342f72706310613d1ef0..210ac81482e9af95b8b929edac67e04a5e757701 100644 --- a/cmd/server/app/network/controller/agentcontroller/script.go +++ b/cmd/server/app/network/controller/agentcontroller/script.go @@ -15,7 +15,6 @@ package agentcontroller import ( - "fmt" "net/http" "gitee.com/openeuler/PilotGo/cmd/server/app/agentmanager" @@ -23,18 +22,18 @@ import ( "github.com/gin-gonic/gin" ) -func RunScript(c *gin.Context) { +func RunCmd(c *gin.Context) { logger.Debug("process get agent request") // TODO: process agent info uuid := c.Query("uuid") cmd := c.Query("cmd") - fmt.Println(uuid, cmd) agent := agentmanager.GetAgent(uuid) if agent != nil { data, err := agent.RunCommand(cmd) if err != nil { logger.Error("run script error, agent:%s, cmd:%s", uuid, cmd) + // TODO : Modify the return message body c.JSON(http.StatusOK, `{"status":-1}`) } logger.Info("run command on agent result:%v", data) @@ -45,3 +44,6 @@ func RunScript(c *gin.Context) { logger.Info("unknown agent:%s", uuid) c.JSON(http.StatusOK, `{"status":-1}`) } + +// func RunScript(c *gin.Context) { +// } diff --git a/cmd/server/app/network/controller/pluginapi/script.go b/cmd/server/app/network/controller/pluginapi/script.go index c178badce30c4259ab5f7088e3e3caa0759ecffc..39221d43957eb7bdd192e5e621cbf00586af1e67 100644 --- a/cmd/server/app/network/controller/pluginapi/script.go +++ b/cmd/server/app/network/controller/pluginapi/script.go @@ -124,7 +124,7 @@ func RunScriptHandler(c *gin.Context) { } auditlog.Add(log)*/ logger.Debug("run script on agents :%v", d.Batch.MachineUUIDs) - + // TODO : shellcheck f := func(uuid string) batch.R { agent := agentmanager.GetAgent(uuid) if agent != nil { /* diff --git a/cmd/server/app/network/httpserver.go b/cmd/server/app/network/httpserver.go index 26815e11560452c367317568657eb369b58ff764..7496e8583d988d54bbe47fba90d9f217321ca243 100644 --- a/cmd/server/app/network/httpserver.go +++ b/cmd/server/app/network/httpserver.go @@ -208,7 +208,7 @@ func registerAPIs(router *gin.Engine) { { macDetails.GET("/agent_overview", agentcontroller.AgentOverviewHandler) macDetails.GET("/agent_list", agentcontroller.AgentListHandler) - macDetails.GET("/run_script", agentcontroller.RunScript) + macDetails.GET("/run_command", agentcontroller.RunCmd) macDetails.GET("/os_info", agentcontroller.OSInfoHandler) macDetails.GET("/cpu_info", agentcontroller.CPUInfoHandler) macDetails.GET("/memory_info", agentcontroller.MemoryInfoHandler)