Skip to content

Commit

Permalink
remove debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishek9686 committed Mar 4, 2024
1 parent c25a732 commit 8e05807
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 14 deletions.
6 changes: 0 additions & 6 deletions controllers/hosts.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand All @@ -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)
}
Expand Down
8 changes: 0 additions & 8 deletions logic/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -212,15 +210,13 @@ func DeleteNode(node *models.Node, purge bool) error {
UpsertNode(&relayNode)
}
}
logger.Log(0, "Hereeeee-----> 4.3")
if node.FailedOverBy != uuid.Nil {
ResetFailedOverPeer(node)
}
if node.IsRelay {
// 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 {
Expand All @@ -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
Expand All @@ -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
}
Expand Down

0 comments on commit 8e05807

Please sign in to comment.