mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-11 21:10:29 +01:00
Webhooks do not work when performing updates in bulk mode #6126
Closed
opened 2025-12-29 19:37:02 +01:00 by adam
·
7 comments
No Branch/Tag Specified
main
update-changelog-comments-docs
feature-removal-issue-type
20911-dropdown
20239-plugin-menu-classes-mutable-state
21097-graphql-id-lookups
feature
fix_module_substitution
20923-dcim-templates
20044-elevation-stuck-lightmode
feature-ip-prefix-link
v4.5-beta1-release
20068-import-moduletype-attrs
20766-fix-german-translation-code-literals
20378-del-script
7604-filter-modifiers-v3
circuit-swap
12318-case-insensitive-uniqueness
20637-improve-device-q-filter
20660-script-load
19724-graphql
20614-update-ruff
14884-script
02496-max-page
19720-macaddress-interface-generic-relation
19408-circuit-terminations-export-templates
20203-openapi-check
fix-19669-api-image-download
7604-filter-modifiers
19275-fixes-interface-bulk-edit
fix-17794-get_field_value_return_list
11507-show-aggregate-and-rir-on-api
9583-add_column_specific_search_field_to_tables
v4.5.0
v4.4.10
v4.4.9
v4.5.0-beta1
v4.4.8
v4.4.7
v4.4.6
v4.4.5
v4.4.4
v4.4.3
v4.4.2
v4.4.1
v4.4.0
v4.3.7
v4.4.0-beta1
v4.3.6
v4.3.5
v4.3.4
v4.3.3
v4.3.2
v4.3.1
v4.3.0
v4.2.9
v4.3.0-beta2
v4.2.8
v4.3.0-beta1
v4.2.7
v4.2.6
v4.2.5
v4.2.4
v4.2.3
v4.2.2
v4.2.1
v4.2.0
v4.1.11
v4.1.10
v4.1.9
v4.1.8
v4.2-beta1
v4.1.7
v4.1.6
v4.1.5
v4.1.4
v4.1.3
v4.1.2
v4.1.1
v4.1.0
v4.0.11
v4.0.10
v4.0.9
v4.1-beta1
v4.0.8
v4.0.7
v4.0.6
v4.0.5
v4.0.3
v4.0.2
v4.0.1
v4.0.0
v3.7.8
v3.7.7
v4.0-beta2
v3.7.6
v3.7.5
v4.0-beta1
v3.7.4
v3.7.3
v3.7.2
v3.7.1
v3.7.0
v3.6.9
v3.6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1
v1.0.3
1.0.0
Labels
Clear labels
beta
breaking change
complexity: high
complexity: low
complexity: medium
needs milestone
netbox
pending closure
plugin candidate
pull-request
severity: high
severity: low
severity: medium
status: accepted
status: backlog
status: blocked
status: duplicate
status: needs owner
status: needs triage
status: revisions needed
status: under review
topic: GraphQL
topic: Internationalization
topic: OpenAPI
topic: UI/UX
topic: cabling
topic: event rules
topic: htmx navigation
topic: industrialization
topic: migrations
topic: plugins
topic: scripts
topic: templating
topic: testing
type: bug
type: deprecation
type: documentation
type: feature
type: housekeeping
type: translation
Mirrored from GitHub Pull Request
No Label
Milestone
No items
No Milestone
Projects
Clear projects
No project
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: starred/netbox#6126
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ane-ruiz on GitHub (Feb 21, 2022).
NetBox version
3.1.7
Python version
3.8
Steps to Reproduce
I am using netbox webhooks to launch an Ansible playbook (via Jenkins). The idea is to launch the playbook every time we update a device interface. Doing this individually works fine. The problem is that when editing several interfaces at the same time (in bulk mode by selecting the check-box), the webhook only does it for one of them (for the first one that makes the change, I understand).
The webhook I have configured:
When I edit the object interface (edit a single interface), for example GigabitEthernet1/0/1 in this case:
The webhook works correctly, in Jenkins (Ansible), I get the following information from "Data (.data as JSON)" after the HTTP post:
{"event": "updated", "timestamp": "2022-02-21 10:04:16.427434+00:00", "model": "interface", "username": "0205491", "request_id": "92738c7b-95b9-44b5-884e-17bd46dabef8", "data": {"id": 16491, "url": "/api/dcim/interfaces/16491/", "display": "GigabitEthernet1/0/1", "device": {"id": 2857, "url": "/api/dcim/devices/2857/", "display": "BCN_P39_prueba", "name": "BCN_P39_prueba"}, "name": "GigabitEthernet1/0/1", "label": "", "type": {"value": "1000base-t", "label": "1000BASE-T (1GE)"}, "enabled": true, "parent": null, "bridge": null, "lag": null, "mtu": null, "mac_address": null, "wwn": "", "mgmt_only": false, "description": "Prueba webhook", "mode": {"value": "access", "label": "Access"}, "rf_role": null, "rf_channel": null, "rf_channel_frequency": null, "rf_channel_width": null, "tx_power": null, "untagged_vlan": {"id": 330, "url": "/api/ipam/vlans/330/", "display": "GESTION (252)", "vid": 252, "name": "GESTION"}, "tagged_vlans": [], "mark_connected": false, "cable": null, "wireless_link": null, "link_peer": null, "link_peer_type": null, "wireless_lans": [], "connected_endpoint": null, "connected_endpoint_type": null, "connected_endpoint_reachable": null, "tags": [{"id": 1, "url": "/api/extras/tags/1/", "display": "BCN_ap_int", "name": "BCN_ap_int", "slug": "bcn_ap_int", "color": "8bc34a"}], "custom_fields": {}, "created": "2021-09-01", "last_updated": "2022-02-21T11:04:16.316469+01:00", "count_ipaddresses": 0, "count_fhrp_groups": 0, "_occupied": false}, "snapshots": {"prechange": {"created": "2021-09-01", "last_updated": "2022-02-17T15:54:55.466Z", "device": 2857, "name": "GigabitEthernet1/0/8", "label": "", "description": "AP Controller", "cable": null, "mark_connected": false, "enabled": true, "mac_address": null, "mtu": null, "mode": "access", "parent": null, "bridge": null, "lag": null, "type": "1000base-t", "mgmt_only": false, "wwn": null, "rf_role": "", "rf_channel": "", "rf_channel_frequency": null, "rf_channel_width": null, "tx_power": null, "wireless_link": null, "untagged_vlan": 330, "wireless_lans": [], "tagged_vlans": [], "custom_fields": {}, "tags": ["BCN_ap_int"]}, "postchange": {"created": "2021-09-01", "last_updated": "2022-02-21T10:04:16.316Z", "device": 2857, "name": "GigabitEthernet1/0/1", "label": "", "description": "Prueba webhook", "cable": null, "mark_connected": false, "enabled": true, "mac_address": null, "mtu": null, "mode": "access", "parent": null, "bridge": null, "lag": null, "type": "1000base-t", "mgmt_only": false, "wwn": "", "rf_role": "", "rf_channel": "", "rf_channel_frequency": null, "rf_channel_width": null, "tx_power": null, "wireless_link": null, "untagged_vlan": 330, "wireless_lans": [], "tagged_vlans": [], "custom_fields": {}, "tags": ["BCN_ap_int"]}}}This result is correct, the webhook here works correctly.
The problem is when I want to edit more than one interface at a time (for example, to make the same changes on all of them, I select several interfaces in the list of device interfaces):
When I edit the interfaces in this way, the result I get is only that of the first selected interface. I only receive the "data" (the update information) for one of the interfaces. In the tests I have made, I only receive the information of the first interface of the selected group/list (the information of that interface arrives in the same format that I have indicated in the correct result).
This way, it seems that the webhook is launched only once, as if only one object (in this case interfaces) has been modified, instead of applying the webhook for each update.
How can I get the information of the 3 simultaneous changes (in this example)?
Expected Behavior
What I would like is for the Webhook option to launch as many webhooks as interfaces you modify. I don't know if there is a way to make it work in bulk mode to make several changes simultaneously.
If there is a way, could you point me in the right direction? If not, will it be possible in an update?
Observed Behavior
Currently it only executes a single webhook action that applies to a single object (in my case, a single interface).
I hope you can help me.
Thank you very much!!
@jeremystretch commented on GitHub (Feb 21, 2022):
Thank you for opening a bug report. Unfortunately, the information you have provided is not sufficient for someone else to attempt to reproduce the reported behavior. Remember, each bug report must include detailed steps that someone else can follow on a clean, empty NetBox installation to reproduce the exact problem you're experiencing. These instructions should include the creation of any involved objects, any configuration changes, and complete accounting of the actions being taken. Also be sure that your report does not reference data on the public NetBox demo, as that is subject to change at any time by an outside party and cannot be relied upon for bug reports.
@kkthxbye-code commented on GitHub (Feb 21, 2022):
I just tested this on the demo instance, and it works fine there.
I create a webhook for dcim->interface and bulk edited 5 interfaces adding a label (The say failed because I pointed the webhook at localhost). So as Jeremy's respons says, you gotta specify what exactly you are doing for anyone to be able to help you.
@ane-ruiz commented on GitHub (Feb 21, 2022):
Hello,
Thank you for your answers, I have just updated the information I had put at the beginning, please check it if you can.
I don't know why this morning I didn't see the "job results", but now I do. In principle this is being done correctly, but I can't get the information of the 3 simultaneous changes of the example:
Thank you for your help!
@kkthxbye-code commented on GitHub (Feb 21, 2022):
I don't know what that means. Three webhooks are fired as expected, each containing the changes for one of the interfaces. What data are you missing?
Edit: I maybe see what you mean. You want bulk requests to result in one single webhook containing the changes for all three seperate objects. If that is the case, that is not how the webhooks are intended to function. You could try a feature request, but I can't imagine that it would be accepted. In any case it is not a bug.
@ane-ruiz commented on GitHub (Feb 21, 2022):
When I make the 3 changes, in the jobs, as you can see, the 3 webhooks are displayed correctly.
The problem is that of the 3, only 1 HTTP request is generated. I don't need all the changes to be made in one, but I understand that I should have the 3 requests separately. The only thing I see is that it works for the first of the 3 changes. In my case, it only runs one job in Jenkins (Ansible), it doesn't receive the other two changes. On the other hand, if I make the changes independently, if I make them very close together, Jenkins also receives them and waits to execute them because it does it in order.
@kkthxbye-code commented on GitHub (Feb 21, 2022):
If you open the jobs you should be able to see HTTP response code and body content for the requests. I have a hard time imagining that only one is sent. How do you know only one is sent? Could you do a simple tcpdump/wireshark test to see if you are correct in your assumption?
@jeremystretch commented on GitHub (Feb 22, 2022):
NetBox's RQ worker generates one outbounf HTTP request per webhook trigger. You can use the built-in webhook receiver to verify this.
Converting this to a discussion as it does not appear to be a bug.