Browse Source

Merge branch 'GRA-988/add_host_to_network' of https://github.com/gravitl/netmaker into GRA-988/delete_host_from_network

Abhishek Kondur 2 years ago
parent
commit
b017e41e52
1 changed files with 7 additions and 1 deletions
  1. 7 1
      controllers/hosts.go

+ 7 - 1
controllers/hosts.go

@@ -208,7 +208,13 @@ func addHostToNetwork(w http.ResponseWriter, r *http.Request) {
 		return
 	}
 	logger.Log(1, "added new node", newNode.ID.String(), "to host", currHost.Name)
-
+	if err = mq.HostUpdate(&models.HostUpdate{
+		Action: models.JoinHostToNetwork,
+		Host:   *currHost,
+		Node:   *newNode,
+	}); err != nil {
+		logger.Log(0, r.Header.Get("user"), "failed to update host to join network:", hostid, network, err.Error())
+	}
 	networks := logic.GetHostNetworks(currHost.ID.String())
 	if len(networks) > 0 {
 		if err = mq.ModifyClient(&mq.MqClient{