abhishek9686 1 年間 前
コミット
33c7824edf
2 ファイル変更10 行追加0 行削除
  1. 9 0
      controllers/enrollmentkeys.go
  2. 1 0
      logic/hosts.go

+ 9 - 0
controllers/enrollmentkeys.go

@@ -342,6 +342,7 @@ func handleHostRegister(w http.ResponseWriter, r *http.Request) {
 				networksToAdd = append(networksToAdd, newNet)
 			}
 		}
+		fmt.Println("------> REG: network to add", newHost.Name, currentNets, networksToAdd)
 		enrollmentKey.Networks = networksToAdd
 		currHost, err := logic.GetHost(newHost.ID.String())
 		if err != nil {
@@ -349,6 +350,14 @@ func handleHostRegister(w http.ResponseWriter, r *http.Request) {
 			logic.ReturnErrorResponse(w, r, logic.FormatError(err, "internal"))
 			return
 		}
+		fmt.Println("-----> REG: Before: \n")
+		fmt.Printf("------> %+v", newHost)
+		fmt.Printf("------> %+v", currHost)
+		fmt.Println("--------------------- \n")
+		fmt.Println("-----> REG: After: \n")
+		fmt.Printf("------> %+v", newHost)
+		fmt.Printf("------> %+v", currHost)
+		fmt.Println("--------------------- \n")
 		logic.UpdateHostFromClient(&newHost, currHost)
 		err = logic.UpsertHost(currHost)
 		if err != nil {

+ 1 - 0
logic/hosts.go

@@ -349,6 +349,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)
 	} else {
+		fmt.Println("----------->REG:  ADDING NODE TO HOST: ", h.Name)
 		newNode := models.Node{}
 		newNode.Server = servercfg.GetServer()
 		newNode.Network = network