mirror of
https://github.com/gravitl/netmaker.git
synced 2024-11-10 17:48:25 +08:00
edited logs and used pre-existing mq function
This commit is contained in:
parent
01484eec7b
commit
a3b5c10508
1 changed files with 6 additions and 6 deletions
|
@ -240,6 +240,7 @@ func createExtClient(w http.ResponseWriter, r *http.Request) {
|
|||
returnErrorResponse(w, r, formatError(err, "internal"))
|
||||
return
|
||||
}
|
||||
logger.Log(0, r.Header.Get("user"), "created new ext client on network", networkName)
|
||||
w.WriteHeader(http.StatusOK)
|
||||
err = mq.PublishExtPeerUpdate(&node)
|
||||
if err != nil {
|
||||
|
@ -276,12 +277,11 @@ func updateExtClient(w http.ResponseWriter, r *http.Request) {
|
|||
returnErrorResponse(w, r, formatError(err, "internal"))
|
||||
return
|
||||
}
|
||||
logger.Log(1, r.Header.Get("user"), "updated client", newExtClient.ClientID)
|
||||
logger.Log(0, r.Header.Get("user"), "updated ext client", newExtClient.ClientID)
|
||||
if changedEnabled { // need to send a peer update to the ingress node as enablement of one of it's clients has changed
|
||||
serverNode, err := logic.GetNetworkServerLocal(params["network"])
|
||||
if err == nil {
|
||||
if err = mq.PublishPeerUpdate(&serverNode); err != nil {
|
||||
logger.Log(1, "failed to send peer update after enablement change for ext client", newExtClient.ClientID)
|
||||
if ingressNode, err := logic.GetNodeByID(newclient.IngressGatewayID); err == nil {
|
||||
if err = mq.PublishExtPeerUpdate(&ingressNode); err != nil {
|
||||
logger.Log(1, "error setting ext peers on", ingressNode.ID, ":", err.Error())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -322,7 +322,7 @@ func deleteExtClient(w http.ResponseWriter, r *http.Request) {
|
|||
if err != nil {
|
||||
logger.Log(1, "error setting ext peers on "+ingressnode.ID+": "+err.Error())
|
||||
}
|
||||
logger.Log(1, r.Header.Get("user"),
|
||||
logger.Log(0, r.Header.Get("user"),
|
||||
"Deleted extclient client", params["clientid"], "from network", params["network"])
|
||||
returnSuccessResponse(w, r, params["clientid"]+" deleted.")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue