webhook IP delete no presnapshot content when deleting device with IP address #5686

Closed
opened 2025-12-29 19:31:29 +01:00 by adam · 1 comment
Owner

Originally created by @robertpenz on GitHub (Nov 18, 2021).

NetBox version

2.11.6

Python version

3.7

Steps to Reproduce

  1. You've a device with a or multiple IPs assigned to it.
  2. You don't delete the IP address and then the device but the device at once
  3. IP address webhook is called, but the presnapshot content is missing

example dict provided by webhook

{'data': {'address': '10.10.xxx.xxx/22',
          'assigned_object': {'_occupied': True,
                              'cable': 1160,
                              'device': {'display': 'xxxxxxxx',
                                         'display_name': 'xxxxxxxx',
                                         'id': 3832,
                                         'name': 'xxxxxxxx',
                                         'url': '/api/dcim/devices/3832/'},
                              'display': 'ManagementPort',
                              'id': 89532,
                              'name': 'ManagementPort',
                              'url': '/api/dcim/interfaces/89532/'},
          'assigned_object_id': 89532,
          'assigned_object_type': 'dcim.interface',
          'created': '2018-03-05',
          'custom_fields': {'lastseen': None, 'vrrpId': None},
          'description': '',
          'display': '10.10.xxx.xxx/22',
          'dns_name': 'xxxxxxxxxxxxxx.',
          'family': {'label': 'IPv4', 'value': 4},
          'id': 10956,
          'last_updated': '2019-11-08T08:04:57.366752+01:00',
          'nat_inside': None,
          'nat_outside': None,
          'role': None,
          'status': {'label': 'Active', 'value': 'active'},
          'tags': [],
          'tenant': None,
          'url': '/api/ipam/ip-addresses/10956/',
          'vrf': None},
 'event': 'deleted',
 'model': 'ipaddress',
 'request_id': '5dc01940-2168-46df-9ad6-4dcdf566e942',
 'snapshots': {'postchange': None, 'prechange': None},
 'timestamp': '2021-11-17 07:10:56.729127+00:00',
 'username': 'xxxxxxxx'}

Expected Behavior

The web hook should provide the same info in presnapshot as when I delete the IP address directly, as shown in this example webhook dict:

{'data': {'address': '10.10.xxx.xxx/22',
          'assigned_object': {'_occupied': True,
                              'cable': 5540,
                              'device': {'display': 'xxxxxxxx',
                                         'display_name': 'xxxxxxxx',
                                         'id': 3986,
                                         'name': 'xxxxxxxx',
                                         'url': '/api/dcim/devices/3986/'},
                              'display': 'Mgmt',
                              'id': 63398,
                              'name': 'Mgmt',
                              'url': '/api/dcim/interfaces/63398/'},
          'assigned_object_id': 63398,
          'assigned_object_type': 'dcim.interface',
          'created': '2017-10-02',
          'custom_fields': {'lastseen': '2021-05-23', 'vrrpId': None},
          'description': 'autogenerated',
          'display': '10.10.xxx.xxx/22',
          'dns_name': 'xxxxxxxx',
          'family': {'label': 'IPv4', 'value': 4},
          'id': 499,
          'last_updated': '2021-10-21T16:53:38.901894+02:00',
          'nat_inside': None,
          'nat_outside': None,
          'role': None,
          'status': {'label': 'Active', 'value': 'active'},
          'tags': [],
          'tenant': None,
          'url': '/api/ipam/ip-addresses/499/',
          'vrf': None},
 'event': 'deleted',
 'model': 'ipaddress',
 'request_id': 'e643e963-4b5c-4cf7-ab0d-54c581f4a06f',
 'snapshots': {'postchange': None,
               'prechange': {'address': '10.10.xxx.xxx/22',
                             'assigned_object_id': 63398,
                             'assigned_object_type': 26,
                             'created': '2017-10-02',
                             'custom_fields': {'lastseen': '2021-05-23'},
                             'description': 'autogenerated',
                             'dns_name': 'xxxxxxxx',
                             'last_updated': '2021-10-21T14:53:38.901Z',
                             'nat_inside': None,
                             'role': '',
                             'status': 'active',
                             'tags': [],
                             'tenant': None,
                             'vrf': None}},
 'timestamp': '2021-11-17 12:31:14.425682+00:00',
 'username': 'xxxxxxxx'}

Observed Behavior

no presnapshot provided in some cases.

Originally created by @robertpenz on GitHub (Nov 18, 2021). ### NetBox version 2.11.6 ### Python version 3.7 ### Steps to Reproduce 0. You've a device with a or multiple IPs assigned to it. 1. You don't delete the IP address and then the device but the device at once 2. IP address webhook is called, but the presnapshot content is missing example dict provided by webhook ``` {'data': {'address': '10.10.xxx.xxx/22', 'assigned_object': {'_occupied': True, 'cable': 1160, 'device': {'display': 'xxxxxxxx', 'display_name': 'xxxxxxxx', 'id': 3832, 'name': 'xxxxxxxx', 'url': '/api/dcim/devices/3832/'}, 'display': 'ManagementPort', 'id': 89532, 'name': 'ManagementPort', 'url': '/api/dcim/interfaces/89532/'}, 'assigned_object_id': 89532, 'assigned_object_type': 'dcim.interface', 'created': '2018-03-05', 'custom_fields': {'lastseen': None, 'vrrpId': None}, 'description': '', 'display': '10.10.xxx.xxx/22', 'dns_name': 'xxxxxxxxxxxxxx.', 'family': {'label': 'IPv4', 'value': 4}, 'id': 10956, 'last_updated': '2019-11-08T08:04:57.366752+01:00', 'nat_inside': None, 'nat_outside': None, 'role': None, 'status': {'label': 'Active', 'value': 'active'}, 'tags': [], 'tenant': None, 'url': '/api/ipam/ip-addresses/10956/', 'vrf': None}, 'event': 'deleted', 'model': 'ipaddress', 'request_id': '5dc01940-2168-46df-9ad6-4dcdf566e942', 'snapshots': {'postchange': None, 'prechange': None}, 'timestamp': '2021-11-17 07:10:56.729127+00:00', 'username': 'xxxxxxxx'} ``` ### Expected Behavior The web hook should provide the same info in presnapshot as when I delete the IP address directly, as shown in this example webhook dict: ``` {'data': {'address': '10.10.xxx.xxx/22', 'assigned_object': {'_occupied': True, 'cable': 5540, 'device': {'display': 'xxxxxxxx', 'display_name': 'xxxxxxxx', 'id': 3986, 'name': 'xxxxxxxx', 'url': '/api/dcim/devices/3986/'}, 'display': 'Mgmt', 'id': 63398, 'name': 'Mgmt', 'url': '/api/dcim/interfaces/63398/'}, 'assigned_object_id': 63398, 'assigned_object_type': 'dcim.interface', 'created': '2017-10-02', 'custom_fields': {'lastseen': '2021-05-23', 'vrrpId': None}, 'description': 'autogenerated', 'display': '10.10.xxx.xxx/22', 'dns_name': 'xxxxxxxx', 'family': {'label': 'IPv4', 'value': 4}, 'id': 499, 'last_updated': '2021-10-21T16:53:38.901894+02:00', 'nat_inside': None, 'nat_outside': None, 'role': None, 'status': {'label': 'Active', 'value': 'active'}, 'tags': [], 'tenant': None, 'url': '/api/ipam/ip-addresses/499/', 'vrf': None}, 'event': 'deleted', 'model': 'ipaddress', 'request_id': 'e643e963-4b5c-4cf7-ab0d-54c581f4a06f', 'snapshots': {'postchange': None, 'prechange': {'address': '10.10.xxx.xxx/22', 'assigned_object_id': 63398, 'assigned_object_type': 26, 'created': '2017-10-02', 'custom_fields': {'lastseen': '2021-05-23'}, 'description': 'autogenerated', 'dns_name': 'xxxxxxxx', 'last_updated': '2021-10-21T14:53:38.901Z', 'nat_inside': None, 'role': '', 'status': 'active', 'tags': [], 'tenant': None, 'vrf': None}}, 'timestamp': '2021-11-17 12:31:14.425682+00:00', 'username': 'xxxxxxxx'} ``` ### Observed Behavior no presnapshot provided in some cases.
adam added the type: bugstatus: duplicate labels 2025-12-29 19:31:29 +01:00
adam closed this issue 2025-12-29 19:31:29 +01:00
Author
Owner

@jeremystretch commented on GitHub (Nov 18, 2021):

Thank you for submitting this issue, however it appears that this topic has already been raised. Please see issue #6389 for further discussion.

@jeremystretch commented on GitHub (Nov 18, 2021): Thank you for submitting this issue, however it appears that this topic has already been raised. Please see issue #6389 for further discussion.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#5686