Replies: 8 comments 2 replies
-
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. |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
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! |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
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? |
Beta Was this translation helpful? Give feedback.
-
NetBox's RQ worker generates one outbound 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. |
Beta Was this translation helpful? Give feedback.
-
I have been able to solve it, indeed the failure was not on the netbox side, but the tool (jenkins) was not being able to process them separately. I have found a way to solve it and it works perfectly. Thank you very much for helping me!!! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
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!!
Beta Was this translation helpful? Give feedback.
All reactions