diff --git a/automation/server/go.mod b/automation/server/go.mod index 558711c79dcb3d421e6313c5c96567420e9225bf..022cb19ec3ac788c5899d7710fae9ad393085709 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 a9acac23e0b17de85856745349b7423f9fc3cac4..7bcd6886241f7f5919f19690e3bcf5951f7985eb 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 1315551df6b6550a791ff5b8d4ed2d5481f0f03f..f9e4b95fd0df5ff7fae1117aad77679b713f99fb 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 fbcd4913c3f812ee43f3921e3b7c3a397e193d90..652525991c80b495527014443f50aa4141becec4 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 40b8bb5411cfba546e4438f4801e8266865f262f..68250dc8f52e377f614bf3148fc9e39e9253463c 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