We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8dfec7e commit 35bfe83Copy full SHA for 35bfe83
netbox/ipam/signals.py
@@ -56,8 +56,12 @@ def clear_primary_ip(instance, **kwargs):
56
"""
57
field_name = f'primary_ip{instance.family}'
58
if device := Device.objects.filter(**{field_name: instance}).first():
59
+ device.snapshot()
60
+ setattr(device, field_name, None)
61
device.save()
62
if virtualmachine := VirtualMachine.objects.filter(**{field_name: instance}).first():
63
+ virtualmachine.snapshot()
64
+ setattr(virtualmachine, field_name, None)
65
virtualmachine.save()
66
67
@@ -67,4 +71,6 @@ def clear_oob_ip(instance, **kwargs):
71
When an IPAddress is deleted, trigger save() on any Devices for which it was a OOB IP.
68
72
69
73
if device := Device.objects.filter(oob_ip=instance).first():
74
75
+ device.oob_ip = None
70
76
0 commit comments