mirror of
https://github.com/gravitl/netmaker.git
synced 2025-09-08 14:15:25 +08:00
testing server update
This commit is contained in:
parent
09c2f9bf8b
commit
3964d927ea
3 changed files with 12 additions and 7 deletions
|
@ -569,7 +569,7 @@ func updateNode(w http.ResponseWriter, r *http.Request) {
|
|||
w.WriteHeader(http.StatusOK)
|
||||
json.NewEncoder(w).Encode(newNode)
|
||||
|
||||
runUpdates(&node, true)
|
||||
runUpdates(&newNode, true)
|
||||
}
|
||||
|
||||
func deleteNode(w http.ResponseWriter, r *http.Request) {
|
||||
|
|
|
@ -165,6 +165,9 @@ func NodeUpdate(client mqtt.Client, msg mqtt.Message) {
|
|||
return
|
||||
}
|
||||
|
||||
log.Println("DELETE: new node addres: " + newNode.Address)
|
||||
log.Println("DELETE: current node addres: " + cfg.Node.Address)
|
||||
|
||||
ncutils.Log("received message to update node " + newNode.Name)
|
||||
// see if cache hit, if so skip
|
||||
var currentMessage = read(newNode.Network, lastNodeUpdate)
|
||||
|
@ -182,6 +185,7 @@ func NodeUpdate(client mqtt.Client, msg mqtt.Message) {
|
|||
//ensure that OS never changes
|
||||
newNode.OS = runtime.GOOS
|
||||
// check if interface needs to delta
|
||||
log.Println("DELETE: running ifacedelta")
|
||||
ifaceDelta := ncutils.IfaceDelta(&cfg.Node, &newNode)
|
||||
|
||||
cfg.Node = newNode
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
package ncutils
|
||||
|
||||
import "github.com/gravitl/netmaker/models"
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/gravitl/netmaker/models"
|
||||
)
|
||||
|
||||
func IfaceDelta(currentNode *models.Node, newNode *models.Node) bool {
|
||||
// single comparison statements
|
||||
if currentNode.IsServer != "yes" {
|
||||
return false
|
||||
}
|
||||
|
||||
log.Println("DELETE: checking stuff")
|
||||
if newNode.Endpoint != currentNode.Endpoint ||
|
||||
newNode.LocalAddress != currentNode.LocalAddress ||
|
||||
newNode.PublicKey != currentNode.PublicKey ||
|
||||
|
@ -57,7 +58,7 @@ func IfaceDelta(currentNode *models.Node, newNode *models.Node) bool {
|
|||
return true
|
||||
}
|
||||
}
|
||||
|
||||
log.Println("DELETE: guess it's false")
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue