mirror of
https://github.com/gravitl/netmaker.git
synced 2025-11-17 14:38:41 +08:00
extclient update
This commit is contained in:
parent
88358f517c
commit
d4cd24e778
2 changed files with 14 additions and 4 deletions
|
|
@ -497,10 +497,7 @@ func updateExtClient(w http.ResponseWriter, r *http.Request) {
|
|||
json.NewEncoder(w).Encode(newclient)
|
||||
if changedID {
|
||||
go func() {
|
||||
if err := mq.PublishDeleteExtClientDNS(&oldExtClient); err != nil {
|
||||
logger.Log(1, "error pubishing dns update for extcient update", err.Error())
|
||||
}
|
||||
if err := mq.PublishExtCLientDNS(&newExtClient); err != nil {
|
||||
if err := mq.PublishExtClientDNSUpdate(oldExtClient, newExtClient, networkName); err != nil {
|
||||
logger.Log(1, "error pubishing dns update for extcient update", err.Error())
|
||||
}
|
||||
}()
|
||||
|
|
|
|||
|
|
@ -312,6 +312,19 @@ func PublishExtCLientDNS(client *models.ExtClient) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// PublishExtClientUpdate publishes dns update for extclient name change
|
||||
func PublishExtClientDNSUpdate(old, new models.ExtClient, network string) error {
|
||||
dns := models.DNSUpdate{
|
||||
Action: models.DNSReplaceName,
|
||||
Name: old.ClientID,
|
||||
NewName: new.ClientID,
|
||||
}
|
||||
if err := PublishDNSUpdate(network, dns); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// PublishDeleteExtClient publish dns update to delete extclient entry
|
||||
func PublishDeleteExtClientDNS(client *models.ExtClient) error {
|
||||
dns := models.DNSUpdate{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue