diff --git a/logic/acls/nodeacls/modify.go b/logic/acls/nodeacls/modify.go index 54c898b79..5710dd612 100644 --- a/logic/acls/nodeacls/modify.go +++ b/logic/acls/nodeacls/modify.go @@ -77,14 +77,12 @@ func RemoveNodeACL(networkID NetworkID, nodeID NodeID) (acls.ACLContainer, error if err != nil { return nil, err } - acls.AclMutex.Lock() for currentNodeID := range currentNetworkACL { if NodeID(currentNodeID) != nodeID { currentNetworkACL[currentNodeID].Remove(acls.AclID(nodeID)) } } delete(currentNetworkACL, acls.AclID(nodeID)) - acls.AclMutex.Unlock() return currentNetworkACL.Save(acls.ContainerID(networkID)) } diff --git a/logic/acls/nodeacls/retrieve.go b/logic/acls/nodeacls/retrieve.go index 70870e4d6..15397c24c 100644 --- a/logic/acls/nodeacls/retrieve.go +++ b/logic/acls/nodeacls/retrieve.go @@ -15,8 +15,10 @@ func AreNodesAllowed(networkID NetworkID, node1, node2 NodeID) bool { } var allowed bool acls.AclMutex.RLock() - allowed = currentNetworkACL[acls.AclID(node1)].IsAllowed(acls.AclID(node2)) && currentNetworkACL[acls.AclID(node2)].IsAllowed(acls.AclID(node1)) + currNetworkACLNode1 := currentNetworkACL[acls.AclID(node1)] + currNetworkACLNode2 := currentNetworkACL[acls.AclID(node2)] acls.AclMutex.RUnlock() + allowed = currNetworkACLNode1.IsAllowed(acls.AclID(node2)) && currNetworkACLNode2.IsAllowed(acls.AclID(node1)) return allowed } diff --git a/logic/hosts.go b/logic/hosts.go index d3dd48bb9..6d8c3b281 100644 --- a/logic/hosts.go +++ b/logic/hosts.go @@ -418,7 +418,6 @@ func DissasociateNodeFromHost(n *models.Node, h *models.Host) error { if err := DeleteNodeByID(n); err != nil { return err } - return UpsertHost(h) } diff --git a/logic/nodes.go b/logic/nodes.go index f5e7e1258..353a33f16 100644 --- a/logic/nodes.go +++ b/logic/nodes.go @@ -189,7 +189,6 @@ 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 - //delete ext clients if node is ingress gw if node.IsIngressGateway { if err := DeleteGatewayExtClients(node.ID.String(), node.Network); err != nil { @@ -235,7 +234,6 @@ func DeleteNode(node *models.Node, purge bool) error { if node.IsInternetGateway { UnsetInternetGw(node) } - if !purge && !alreadyDeleted { newnode := *node newnode.PendingDelete = true @@ -281,7 +279,6 @@ func GetNodeByHostRef(hostid, network string) (node models.Node, err error) { func DeleteNodeByID(node *models.Node) error { var err error var key = node.ID.String() - if err = database.DeleteRecord(database.NODES_TABLE_NAME, key); err != nil { if !database.IsEmptyRecord(err) { return err