|
@@ -272,10 +272,7 @@ func updateHost(w http.ResponseWriter, r *http.Request) {
|
|
logic.ReturnErrorResponse(w, r, logic.FormatError(err, "internal"))
|
|
logic.ReturnErrorResponse(w, r, logic.FormatError(err, "internal"))
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- if !reflect.DeepEqual(currHost.EgressServices, newHost.EgressServices) {
|
|
|
|
- // update egress range on nodes
|
|
|
|
- logic.MapExternalServicesToHostNodes(newHost)
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
// publish host update through MQ
|
|
// publish host update through MQ
|
|
if err := mq.HostUpdate(&models.HostUpdate{
|
|
if err := mq.HostUpdate(&models.HostUpdate{
|
|
Action: models.UpdateHost,
|
|
Action: models.UpdateHost,
|
|
@@ -289,6 +286,23 @@ func updateHost(w http.ResponseWriter, r *http.Request) {
|
|
err.Error(),
|
|
err.Error(),
|
|
)
|
|
)
|
|
}
|
|
}
|
|
|
|
+ if !reflect.DeepEqual(newHost.EgressServices, currHost.EgressServices) {
|
|
|
|
+ // update egress range on nodes
|
|
|
|
+ logic.MapExternalServicesToHostNodes(newHost)
|
|
|
|
+ // publish host update through MQ
|
|
|
|
+ if err := mq.HostUpdate(&models.HostUpdate{
|
|
|
|
+ Action: models.DiscoverEgressIps,
|
|
|
|
+ Host: *newHost,
|
|
|
|
+ }); err != nil {
|
|
|
|
+ logger.Log(
|
|
|
|
+ 0,
|
|
|
|
+ r.Header.Get("user"),
|
|
|
|
+ "failed to send host update: ",
|
|
|
|
+ currHost.ID.String(),
|
|
|
|
+ err.Error(),
|
|
|
|
+ )
|
|
|
|
+ }
|
|
|
|
+ }
|
|
go func() {
|
|
go func() {
|
|
if err := mq.PublishPeerUpdate(false); err != nil {
|
|
if err := mq.PublishPeerUpdate(false); err != nil {
|
|
logger.Log(0, "fail to publish peer update: ", err.Error())
|
|
logger.Log(0, "fail to publish peer update: ", err.Error())
|