From 9844c8b0c604b1ebb6b22d9b63e8917cc0057209 Mon Sep 17 00:00:00 2001 From: zhanghan Date: Wed, 17 Sep 2025 09:55:27 +0800 Subject: [PATCH] Update vendor; Add script execution timeout control --- automation/server/go.mod | 2 +- automation/server/go.sum | 4 ++-- .../server/internal/module/script_library/controller/exec.go | 3 ++- .../gitee.com/openeuler/PilotGo/sdk/plugin/client/scripts.go | 4 +++- vendor/modules.txt | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/automation/server/go.mod b/automation/server/go.mod index 558711c7..022cb19e 100644 --- a/automation/server/go.mod +++ b/automation/server/go.mod @@ -5,7 +5,7 @@ go 1.23.0 toolchain go1.23.7 require ( - gitee.com/openeuler/PilotGo/sdk v0.0.0-20250916064441-cba49a792605 + gitee.com/openeuler/PilotGo/sdk v0.0.0-20250916121620-f7402a7f9376 github.com/gin-gonic/gin v1.9.1 github.com/go-redis/redis/v8 v8.11.5 github.com/go-sql-driver/mysql v1.8.1 diff --git a/automation/server/go.sum b/automation/server/go.sum index a9acac23..7bcd6886 100644 --- a/automation/server/go.sum +++ b/automation/server/go.sum @@ -1,7 +1,7 @@ filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= -gitee.com/openeuler/PilotGo/sdk v0.0.0-20250916064441-cba49a792605 h1:LAtXnGrcKzsuQRVHrrWKD2V7N53stdNSNGaEZgegTTU= -gitee.com/openeuler/PilotGo/sdk v0.0.0-20250916064441-cba49a792605/go.mod h1:MjGXxy1zfF0eQjT932SohfrkgnWGvozgB9sNQX/f/Gs= +gitee.com/openeuler/PilotGo/sdk v0.0.0-20250916121620-f7402a7f9376 h1:E/mUwudTlhaeyf9JZnhlhNg0DGkiAQaGoLTaadNuSJk= +gitee.com/openeuler/PilotGo/sdk v0.0.0-20250916121620-f7402a7f9376/go.mod h1:MjGXxy1zfF0eQjT932SohfrkgnWGvozgB9sNQX/f/Gs= github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM= github.com/bytedance/sonic v1.9.1 h1:6iJ6NqdoxCDr6mbY8h18oSO+cShGSMRGCEo7F2h0x8s= github.com/bytedance/sonic v1.9.1/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U= diff --git a/automation/server/internal/module/script_library/controller/exec.go b/automation/server/internal/module/script_library/controller/exec.go index 1315551d..f9e4b95f 100644 --- a/automation/server/internal/module/script_library/controller/exec.go +++ b/automation/server/internal/module/script_library/controller/exec.go @@ -14,6 +14,7 @@ func ExecScriptHandler(c *gin.Context) { ScriptType string `json:"script_type"` ScriptContent string `json:"script_content"` Params string `json:"params"` + TimeOutSec int `json:"timeoutSec"` } if err := c.ShouldBindJSON(&sr); err != nil { response.Fail(c, nil, err.Error()) @@ -24,7 +25,7 @@ func ExecScriptHandler(c *gin.Context) { response.Fail(c, nil, err.Error()) return } - result, err := global.App.Client.AgentRunScripts(&common.Batch{MachineUUIDs: sr.UUIDS}, sr.ScriptType, utils.EncodeScriptContent(sr.ScriptContent), sr.Params) + result, err := global.App.Client.AgentRunScripts(&common.Batch{MachineUUIDs: sr.UUIDS}, sr.ScriptType, utils.EncodeScriptContent(sr.ScriptContent), sr.Params, sr.TimeOutSec) if err != nil { response.Fail(c, nil, err.Error()) return diff --git a/vendor/gitee.com/openeuler/PilotGo/sdk/plugin/client/scripts.go b/vendor/gitee.com/openeuler/PilotGo/sdk/plugin/client/scripts.go index fbcd4913..65252599 100644 --- a/vendor/gitee.com/openeuler/PilotGo/sdk/plugin/client/scripts.go +++ b/vendor/gitee.com/openeuler/PilotGo/sdk/plugin/client/scripts.go @@ -14,9 +14,10 @@ type ScriptsRun struct { ScriptType string `json:"script_type"` ScriptContent string `json:"script_content"` Params string `json:"params"` + TimeOutSec int `json:"timeoutSec"` } -func (c *Client) AgentRunScripts(batch *common.Batch, scriptType string, script string, params string) ([]*common.CmdResult, error) { +func (c *Client) AgentRunScripts(batch *common.Batch, scriptType string, script string, params string, timeoutSec int) ([]*common.CmdResult, error) { serverInfo, err := c.Registry.Get("pilotgo-server") if err != nil { return nil, err @@ -28,6 +29,7 @@ func (c *Client) AgentRunScripts(batch *common.Batch, scriptType string, script ScriptType: scriptType, ScriptContent: script, Params: params, + TimeOutSec: timeoutSec, } r, err := httputils.Post(url, &httputils.Params{ Body: scriptRun, diff --git a/vendor/modules.txt b/vendor/modules.txt index 40b8bb54..68250dc8 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -15,7 +15,7 @@ filippo.io/edwards25519/field ## explicit; go 1.23.0 # gitee.com/openeuler/PilotGo/sdk v0.0.0-20250820124645-b6480a0f3109 ## explicit; go 1.23.0 -# gitee.com/openeuler/PilotGo/sdk v0.0.0-20250916064441-cba49a792605 +# gitee.com/openeuler/PilotGo/sdk v0.0.0-20250916121620-f7402a7f9376 ## explicit; go 1.23.0 gitee.com/openeuler/PilotGo/sdk/common gitee.com/openeuler/PilotGo/sdk/go-micro/registry -- Gitee