From 990cf058a73fa3e3abe54cf95a2a75c4f1cf2fb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Brod=C3=A9n?= Date: Wed, 15 May 2024 17:28:10 +0200 Subject: [PATCH] Fix: Path not including action --- api/nodes.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/nodes.go b/api/nodes.go index 1eba528d..c9b878d0 100644 --- a/api/nodes.go +++ b/api/nodes.go @@ -59,16 +59,16 @@ func (api *API) PostAction(instanceID int, nodeName string, action string) ( failed map[string]any actionAsRoute string params = make(map[string][]string) - path = fmt.Sprintf("api/instances/%d/actions/%s", instanceID, actionAsRoute) ) + params["nodes"] = append(params["nodes"], nodeName) + if action == "mgmt.restart" { actionAsRoute = "mgmt-restart" } else { actionAsRoute = action } - params["nodes"] = append(params["nodes"], nodeName) - + path := fmt.Sprintf("api/instances/%d/actions/%s", instanceID, actionAsRoute) response, err := api.sling.New().Post(path).BodyJSON(params).Receive(&data, &failed) if err != nil { return nil, err