mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-26 14:06:15 +08:00
skip pending delete nodes
This commit is contained in:
parent
8ad87f5a81
commit
0da99d8437
1 changed files with 2 additions and 6 deletions
|
|
@ -161,7 +161,7 @@ func RemoveHostByID(hostID string) error {
|
|||
func UpdateHostNetwork(h *models.Host, network string, add bool) (*models.Node, error) {
|
||||
for _, nodeID := range h.Nodes {
|
||||
node, err := GetNodeByID(nodeID)
|
||||
if err != nil {
|
||||
if err != nil || node.PendingDelete {
|
||||
continue
|
||||
}
|
||||
if node.Network == network {
|
||||
|
|
@ -175,9 +175,7 @@ func UpdateHostNetwork(h *models.Host, network string, add bool) (*models.Node,
|
|||
}
|
||||
if !add {
|
||||
return nil, errors.New("host not part of the network " + network)
|
||||
}
|
||||
|
||||
if add {
|
||||
} else {
|
||||
newNode := models.Node{}
|
||||
newNode.Server = servercfg.GetServer()
|
||||
newNode.Network = network
|
||||
|
|
@ -186,8 +184,6 @@ func UpdateHostNetwork(h *models.Host, network string, add bool) (*models.Node,
|
|||
}
|
||||
return &newNode, nil
|
||||
}
|
||||
|
||||
return nil, errors.New("failed to update host networks")
|
||||
}
|
||||
|
||||
// AssociateNodeToHost - associates and creates a node with a given host
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue