mirror of
https://github.com/gravitl/netmaker.git
synced 2024-11-11 10:10:46 +08:00
Merge pull request #665 from gravitl/bugfix_v0.10.0_delete_node
fix delete node, publish message to node to be dleted before updating…
This commit is contained in:
commit
844028b07c
1 changed files with 3 additions and 2 deletions
|
@ -589,6 +589,9 @@ func deleteNode(w http.ResponseWriter, r *http.Request) {
|
|||
returnErrorResponse(w, r, formatError(fmt.Errorf("cannot delete server node"), "badrequest"))
|
||||
return
|
||||
}
|
||||
//send update to node to be deleted before deleting on server otherwise message cannot be sent
|
||||
node.Action = models.NODE_DELETE
|
||||
runUpdates(&node, true)
|
||||
err = logic.DeleteNodeByID(&node, false)
|
||||
if err != nil {
|
||||
returnErrorResponse(w, r, formatError(err, "internal"))
|
||||
|
@ -599,11 +602,9 @@ func deleteNode(w http.ResponseWriter, r *http.Request) {
|
|||
returnErrorResponse(w, r, formatError(err, "internal"))
|
||||
return
|
||||
}
|
||||
node.Action = models.NODE_DELETE
|
||||
logger.Log(1, r.Header.Get("user"), "Deleted node", nodeid, "from network", params["network"])
|
||||
returnSuccessResponse(w, r, nodeid+" deleted.")
|
||||
|
||||
runUpdates(&node, true)
|
||||
}
|
||||
|
||||
func runUpdates(node *models.Node, nodeUpdate bool) error {
|
||||
|
|
Loading…
Reference in a new issue