Check if peer name change before update labels (#658)

This commit is contained in:
Maycon Santos 2023-01-20 10:07:37 +01:00 committed by GitHub
parent 5e3502bb83
commit 4406d50c18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -201,11 +201,11 @@ func (am *DefaultAccountManager) UpdatePeer(accountID string, update *Peer) (*Pe
return nil, err
}
if peer.Name != "" {
peer.Name = update.Name
}
peer.SSHEnabled = update.SSHEnabled
if peer.Name != update.Name {
peer.Name = update.Name
existingLabels := account.getPeerDNSLabels()
newLabel, err := getPeerHostLabel(peer.Name, existingLabels)
@ -214,6 +214,7 @@ func (am *DefaultAccountManager) UpdatePeer(accountID string, update *Peer) (*Pe
}
peer.DNSLabel = newLabel
}
account.UpdatePeer(peer)