[PR #2260] [MERGED] Webhook signal refactor - fixes #2282 #12345

Closed
opened 2025-12-29 22:21:00 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/2260
Author: @lampwins
Created: 7/21/2018
Status: Merged
Merged: 7/30/2018
Merged by: @jeremystretch

Base: develop-2.4Head: webhook-signal-refactor


📝 Commits (5)

  • 65c2668 fixes #2137 date type cutsom fields with webhooks
  • b2abad5 refactor of webhook signaling system to use the same middleware mechanics of Changelogging
  • 2216758 pycodestyle cleanup
  • fad7fd7 fix type_delete webhooks after refactor
  • 4775ebb PR updates to webhook signal refactor

📊 Changes

17 files changed (+73 additions, -200 deletions)

View changed files

📝 netbox/circuits/apps.py (+0 -5)
📝 netbox/circuits/models.py (+0 -3)
📝 netbox/dcim/apps.py (+0 -5)
📝 netbox/dcim/models.py (+0 -15)
📝 netbox/extras/middleware.py (+21 -9)
📝 netbox/extras/models.py (+0 -1)
📝 netbox/extras/webhooks.py (+49 -114)
📝 netbox/extras/webhooks_worker.py (+2 -2)
📝 netbox/ipam/apps.py (+0 -7)
📝 netbox/ipam/models.py (+0 -9)
📝 netbox/netbox/settings.py (+1 -1)
📝 netbox/secrets/models.py (+0 -2)
📝 netbox/tenancy/apps.py (+0 -7)
📝 netbox/tenancy/models.py (+0 -2)
📝 netbox/utilities/views.py (+0 -7)
📝 netbox/virtualization/apps.py (+0 -7)
📝 netbox/virtualization/models.py (+0 -4)

📄 Description

Fixes: #2282

This is a refactor of the webhook signaling system.

The underlying mechanics of the Webhook and Change Logging features as they relate to object changes are very similar. Change Logging recently implemented the ChangeLoggingMiddleware to centralize receiving object changes and to handle related objects not being a part of the post_save signal.

This piggybacks the middleware (renaming it to ChangeLoggingAndWebhookMiddleware) to add the webhook enqueuing functionality. I see no point in making it a separate middleware because the operations are nearly identical. The end result is significantly reduces the complexity of the webhook signaling and queuing implementation.

The only outstanding bit at this time is handling bulk delete operations within webhooks.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/2260 **Author:** [@lampwins](https://github.com/lampwins) **Created:** 7/21/2018 **Status:** ✅ Merged **Merged:** 7/30/2018 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop-2.4` ← **Head:** `webhook-signal-refactor` --- ### 📝 Commits (5) - [`65c2668`](https://github.com/netbox-community/netbox/commit/65c266847827785acb4acdc54406a00dc5765b43) fixes #2137 date type cutsom fields with webhooks - [`b2abad5`](https://github.com/netbox-community/netbox/commit/b2abad523b5f64c09f6a8e83ba5212bf32700751) refactor of webhook signaling system to use the same middleware mechanics of Changelogging - [`2216758`](https://github.com/netbox-community/netbox/commit/2216758e4343a0c022e0f6c33ba95e616c129e88) pycodestyle cleanup - [`fad7fd7`](https://github.com/netbox-community/netbox/commit/fad7fd731cac1db7bbcabd3903bebefcc95b555b) fix type_delete webhooks after refactor - [`4775ebb`](https://github.com/netbox-community/netbox/commit/4775ebb5e3a4fbef06e52de48673d7c79f29387b) PR updates to webhook signal refactor ### 📊 Changes **17 files changed** (+73 additions, -200 deletions) <details> <summary>View changed files</summary> 📝 `netbox/circuits/apps.py` (+0 -5) 📝 `netbox/circuits/models.py` (+0 -3) 📝 `netbox/dcim/apps.py` (+0 -5) 📝 `netbox/dcim/models.py` (+0 -15) 📝 `netbox/extras/middleware.py` (+21 -9) 📝 `netbox/extras/models.py` (+0 -1) 📝 `netbox/extras/webhooks.py` (+49 -114) 📝 `netbox/extras/webhooks_worker.py` (+2 -2) 📝 `netbox/ipam/apps.py` (+0 -7) 📝 `netbox/ipam/models.py` (+0 -9) 📝 `netbox/netbox/settings.py` (+1 -1) 📝 `netbox/secrets/models.py` (+0 -2) 📝 `netbox/tenancy/apps.py` (+0 -7) 📝 `netbox/tenancy/models.py` (+0 -2) 📝 `netbox/utilities/views.py` (+0 -7) 📝 `netbox/virtualization/apps.py` (+0 -7) 📝 `netbox/virtualization/models.py` (+0 -4) </details> ### 📄 Description <!-- Thank you for your interest in contributing to NetBox! Please note that our contribution policy requires that a feature request or bug report be opened for approval prior to filing a pull request. This helps avoid wasting time and effort on something that we might not be able to accept. Please indicate the relevant feature request or bug report below. IF YOUR PULL REQUEST DOES NOT REFERENCE AN ACCEPTED BUG REPORT OR FEATURE REQUEST, IT WILL BE MARKED AS INVALID AND CLOSED. --> ### Fixes: #2282 <!-- Please include a summary of the proposed changes below. --> This is a refactor of the webhook signaling system. The underlying mechanics of the Webhook and Change Logging features as they relate to object changes are very similar. Change Logging recently implemented the `ChangeLoggingMiddleware` to centralize receiving object changes and to handle related objects not being a part of the post_save signal. This piggybacks the middleware (renaming it to `ChangeLoggingAndWebhookMiddleware`) to add the webhook enqueuing functionality. I see no point in making it a separate middleware because the operations are nearly identical. The end result is significantly reduces the complexity of the webhook signaling and queuing implementation. ~~The only outstanding bit at this time is handling bulk delete operations within webhooks.~~ --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 22:21:00 +01:00
adam closed this issue 2025-12-29 22:21:00 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#12345