mirror of
https://github.com/portainer/portainer.git
synced 2025-07-19 13:29:41 +02:00
refactor(api): use a standard stack identifier (#1980)
This commit is contained in:
parent
da5a430b8c
commit
b4c2820ad7
14 changed files with 150 additions and 38 deletions
|
@ -1,8 +1,8 @@
|
|||
package stacks
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/portainer/portainer"
|
||||
httperror "github.com/portainer/portainer/http/error"
|
||||
|
@ -14,14 +14,13 @@ func (handler *Handler) cleanUp(stack *portainer.Stack, doCleanUp *bool) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
handler.FileService.RemoveDirectory(stack.ProjectPath)
|
||||
err := handler.FileService.RemoveDirectory(stack.ProjectPath)
|
||||
if err != nil {
|
||||
log.Printf("http error: Unable to cleanup stack creation (err=%s)\n", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func buildStackIdentifier(stackName string, endpointID portainer.EndpointID) string {
|
||||
return stackName + "_" + strconv.Itoa(int(endpointID))
|
||||
}
|
||||
|
||||
// POST request on /api/stacks?type=<type>&method=<method>&endpointId=<endpointId>
|
||||
func (handler *Handler) stackCreate(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
|
||||
stackType, err := request.RetrieveNumericQueryParameter(r, "type", false)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue