Webhooks trigger on custom script dry-run #10817

Closed
opened 2025-12-29 21:36:16 +01:00 by adam · 1 comment
Owner

Originally created by @uedvt359 on GitHub (Feb 27, 2025).

Originally assigned to: @renatoalmeidaoliveira on GitHub.

Deployment Type

Self-hosted

NetBox Version

v4.2.4

Python Version

3.11

Steps to Reproduce

We have a custom script that creates a device, including setting up new IP addresses and interfaces.
Additionally, we have a webhook that triggers on ip address add/update/delete, that triggers DNS and DHCP updates.

When the script is run with "commit changes" disabled, i.e. dry-run mode, the webhooks are triggered, even though these changes were reverted immediately.
This used to work properly (i.e. no webhook triggering) in v4.0.10.

Note that even though the webhook is configured to trigger on deletions, the dry-run only triggered 'event': 'created' webhooks, so it's not a create-and-immediately-delete kind of situation (which IMO would be wrong, too).

Expected Behavior

A dry-run Script should not trigger webhooks. This was the observed behaviour in v4.0.10.

Observed Behavior

A dry-run Script triggers webhooks in v4.2.4, even though the data was never persisted into the database.

Originally created by @uedvt359 on GitHub (Feb 27, 2025). Originally assigned to: @renatoalmeidaoliveira on GitHub. ### Deployment Type Self-hosted ### NetBox Version v4.2.4 ### Python Version 3.11 ### Steps to Reproduce We have a custom script that creates a device, including setting up new IP addresses and interfaces. Additionally, we have a webhook that triggers on ip address add/update/delete, that triggers DNS and DHCP updates. When the script is run with "commit changes" disabled, i.e. dry-run mode, the webhooks are triggered, even though these changes were reverted immediately. This used to work properly (i.e. no webhook triggering) in v4.0.10. Note that even though the webhook is configured to trigger on deletions, the dry-run only triggered `'event': 'created'` webhooks, so it's not a create-and-immediately-delete kind of situation (which IMO would be wrong, too). ### Expected Behavior A dry-run Script should not trigger webhooks. This was the observed behaviour in v4.0.10. ### Observed Behavior A dry-run Script triggers webhooks in v4.2.4, even though the data was never persisted into the database.
adam added the type: bugstatus: acceptedseverity: medium labels 2025-12-29 21:36:16 +01:00
adam closed this issue 2025-12-29 21:36:16 +01:00
Author
Owner

@jeremystretch commented on GitHub (Feb 28, 2025):

I think I've tracked this down to the run() method on ScriptJob. It seems we're no longer accounting for the value of commit when applying request processors:

7aba6500dd/netbox/extras/jobs.py (L101-L106)

@jeremystretch commented on GitHub (Feb 28, 2025): I think I've tracked this down to the `run()` method on ScriptJob. It seems we're no longer accounting for the value of `commit` when applying request processors: https://github.com/netbox-community/netbox/blob/7aba6500ddef8a58d8d914b9899ee987a4a39a94/netbox/extras/jobs.py#L101-L106
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10817