Browse Source

publish dns update on custom dns deletion

Matthew R Kasun 2 years ago
parent
commit
dbad8ac463
2 changed files with 9 additions and 0 deletions
  1. 8 0
      controllers/dns.go
  2. 1 0
      mq/publishers.go

+ 8 - 0
controllers/dns.go

@@ -224,6 +224,14 @@ func deleteDNS(w http.ResponseWriter, r *http.Request) {
 		return
 		return
 	}
 	}
 	json.NewEncoder(w).Encode(entrytext + " deleted.")
 	json.NewEncoder(w).Encode(entrytext + " deleted.")
+	dns := models.DNSUpdate{
+		Action: models.DNSDeleteByName,
+		Name:   entrytext,
+	}
+	if err := mq.PublishDNSUpdate(params["network"], dns); err != nil {
+		logger.Log(0, "failed to publish dns update", err.Error())
+	}
+
 }
 }
 
 
 // GetDNSEntry - gets a DNS entry
 // GetDNSEntry - gets a DNS entry

+ 1 - 0
mq/publishers.go

@@ -326,6 +326,7 @@ func PublishCustomDNS(entry *models.DNSEntry) error {
 	if err := PublishDNSUpdate(entry.Network, dns); err != nil {
 	if err := PublishDNSUpdate(entry.Network, dns); err != nil {
 		return err
 		return err
 	}
 	}
+	return nil
 }
 }
 
 
 // function to collect and store metrics for server nodes
 // function to collect and store metrics for server nodes