mirror of
https://github.com/gravitl/netmaker.git
synced 2024-11-13 13:14:11 +08:00
updated routes to use uuid
This commit is contained in:
parent
9888a84e8a
commit
c70041ddd0
1 changed files with 22 additions and 22 deletions
|
@ -48,7 +48,7 @@ func DeleteNodeByMacAddress(node *models.Node, exterminate bool) error {
|
||||||
var key = node.ID
|
var key = node.ID
|
||||||
if !exterminate {
|
if !exterminate {
|
||||||
args := strings.Split(key, "###")
|
args := strings.Split(key, "###")
|
||||||
node, err := GetNode(args[0], args[1])
|
node, err := GetNodeByMacAddress(args[0], args[1])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -160,29 +160,29 @@ func SetNetworkNodesLastModified(networkName string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetNode - fetches a node from database
|
// // GetNode - fetches a node from database
|
||||||
func GetNode(macaddress string, network string) (models.Node, error) {
|
// func GetNode(macaddress string, network string) (models.Node, error) {
|
||||||
var node models.Node
|
// var node models.Node
|
||||||
|
|
||||||
key, err := GetRecordKey(macaddress, network)
|
// key, err := GetRecordKey(macaddress, network)
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
return node, err
|
// return node, err
|
||||||
}
|
// }
|
||||||
data, err := database.FetchRecord(database.NODES_TABLE_NAME, key)
|
// data, err := database.FetchRecord(database.NODES_TABLE_NAME, key)
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
if data == "" {
|
// if data == "" {
|
||||||
data, _ = database.FetchRecord(database.DELETED_NODES_TABLE_NAME, key)
|
// data, _ = database.FetchRecord(database.DELETED_NODES_TABLE_NAME, key)
|
||||||
err = json.Unmarshal([]byte(data), &node)
|
// err = json.Unmarshal([]byte(data), &node)
|
||||||
}
|
// }
|
||||||
return node, err
|
// return node, err
|
||||||
}
|
// }
|
||||||
if err = json.Unmarshal([]byte(data), &node); err != nil {
|
// if err = json.Unmarshal([]byte(data), &node); err != nil {
|
||||||
return node, err
|
// return node, err
|
||||||
}
|
// }
|
||||||
SetNodeDefaults(&node)
|
// SetNodeDefaults(&node)
|
||||||
|
|
||||||
return node, err
|
// return node, err
|
||||||
}
|
// }
|
||||||
|
|
||||||
// DeleteNodeByID - deletes a node from database or moves into delete nodes table
|
// DeleteNodeByID - deletes a node from database or moves into delete nodes table
|
||||||
func DeleteNodeByID(node *models.Node, exterminate bool) error {
|
func DeleteNodeByID(node *models.Node, exterminate bool) error {
|
||||||
|
|
Loading…
Reference in a new issue