From 8e0580764bb7097f9406f04b120e5b4e10e60c1e Mon Sep 17 00:00:00 2001 From: abhishek9686 Date: Mon, 4 Mar 2024 13:14:51 +0700 Subject: [PATCH] remove debug logs --- controllers/hosts.go | 6 ------ logic/nodes.go | 8 -------- 2 files changed, 14 deletions(-) diff --git a/controllers/hosts.go b/controllers/hosts.go index 1a038398f..4cee62f61 100644 --- a/controllers/hosts.go +++ b/controllers/hosts.go @@ -396,7 +396,6 @@ func deleteHostFromNetwork(w http.ResponseWriter, r *http.Request) { logic.ReturnErrorResponse(w, r, logic.FormatError(errors.New("hostid or network cannot be empty"), "badrequest")) return } - logger.Log(0, "Hereeeee-----> 1") // confirm host exists currHost, err := logic.GetHost(hostid) if err != nil { @@ -422,7 +421,6 @@ func deleteHostFromNetwork(w http.ResponseWriter, r *http.Request) { logic.ReturnErrorResponse(w, r, logic.FormatError(err, "internal")) return } - logger.Log(0, "Hereeeee-----> 2") node, err := logic.UpdateHostNetwork(currHost, network, false) if err != nil { @@ -447,25 +445,21 @@ func deleteHostFromNetwork(w http.ResponseWriter, r *http.Request) { logic.ReturnErrorResponse(w, r, logic.FormatError(err, "internal")) return } - logger.Log(0, "Hereeeee-----> 3") var gwClients []models.ExtClient if node.IsIngressGateway { gwClients = logic.GetGwExtclients(node.ID.String(), node.Network) } - logger.Log(0, "Hereeeee-----> 4") logger.Log(1, "deleting node", node.ID.String(), "from host", currHost.Name) if err := logic.DeleteNode(node, forceDelete); err != nil { logic.ReturnErrorResponse(w, r, logic.FormatError(fmt.Errorf("failed to delete node"), "internal")) return } - logger.Log(0, "Hereeeee-----> 5") go func() { mq.PublishMqUpdatesForDeletedNode(*node, true, gwClients) if servercfg.IsDNSMode() { logic.SetDNS() } }() - logger.Log(0, "Hereeeee-----> 6") logger.Log(2, r.Header.Get("user"), fmt.Sprintf("removed host %s from network %s", currHost.Name, network)) w.WriteHeader(http.StatusOK) } diff --git a/logic/nodes.go b/logic/nodes.go index 7304ef54c..353a33f16 100644 --- a/logic/nodes.go +++ b/logic/nodes.go @@ -189,14 +189,12 @@ func UpdateNode(currentNode *models.Node, newNode *models.Node) error { func DeleteNode(node *models.Node, purge bool) error { alreadyDeleted := node.PendingDelete || node.Action == models.NODE_DELETE node.Action = models.NODE_DELETE - logger.Log(0, "Hereeeee-----> 4.1") //delete ext clients if node is ingress gw if node.IsIngressGateway { if err := DeleteGatewayExtClients(node.ID.String(), node.Network); err != nil { slog.Error("failed to delete ext clients", "nodeid", node.ID.String(), "error", err.Error()) } } - logger.Log(0, "Hereeeee-----> 4.2") if node.IsRelayed { // cleanup node from relayednodes on relay node relayNode, err := GetNodeByID(node.RelayedBy) @@ -212,7 +210,6 @@ func DeleteNode(node *models.Node, purge bool) error { UpsertNode(&relayNode) } } - logger.Log(0, "Hereeeee-----> 4.3") if node.FailedOverBy != uuid.Nil { ResetFailedOverPeer(node) } @@ -220,7 +217,6 @@ func DeleteNode(node *models.Node, purge bool) error { // unset all the relayed nodes SetRelayedNodes(false, node.ID.String(), node.RelayedNodes) } - logger.Log(0, "Hereeeee-----> 4.4") if node.InternetGwID != "" { inetNode, err := GetNodeByID(node.InternetGwID) if err == nil { @@ -235,11 +231,9 @@ func DeleteNode(node *models.Node, purge bool) error { UpsertNode(&inetNode) } } - logger.Log(0, "Hereeeee-----> 4.5") if node.IsInternetGateway { UnsetInternetGw(node) } - logger.Log(0, "Hereeeee-----> 4.6") if !purge && !alreadyDeleted { newnode := *node newnode.PendingDelete = true @@ -260,11 +254,9 @@ func DeleteNode(node *models.Node, purge bool) error { } return err } - logger.Log(0, "Hereeeee-----> 4.7") if err := DissasociateNodeFromHost(node, host); err != nil { return err } - logger.Log(0, "Hereeeee-----> 4.8") return nil }