You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[fix] Ensure VpnClient.post_delete fires on VPN template removal #1221
Replaced QuerySet.delete() with per-instance deletion in all three
locations where VpnClient objects are bulk-deleted so that post_delete
signals fire for every instance, ensuring:
- VPN peer cache is invalidated on the affected VPN server
- Client certificates are revoked (OpenVPN, auto_cert=True)
- IP addresses are released (Wireguard)
Also fixed the serializers.py cleanup logic: vpn_list was built from
the old templates so .exclude(vpn__in=vpn_list) never matched the
client being removed. Now uses new_vpn_ids from config_templates (the
incoming new set) so PATCH with an empty templates list also works.
Added select_related("vpn", "cert", "ip") to all deletion querysets
to avoid N+1 queries triggered by the post_delete signal handler.
Wrapped deletion loops in transaction.atomic() to prevent partial
deletions on failure.
Fixes#1221
[backport 1.2]
0 commit comments