Only one event rule triggers for a content type #9102

Closed
opened 2025-12-29 20:45:28 +01:00 by adam · 1 comment
Owner

Originally created by @markkuleinio on GitHub (Jan 17, 2024).

Originally assigned to: @jeremystretch on GitHub.

Deployment Type

Self-hosted

NetBox Version

v3.7.0

Python Version

3.11

Steps to Reproduce

Setup:

  1. Create a webhook: Name = Test, URL = http://127.0.0.1:9000
  2. Create event rule 1:
    • Name = Rule 1
    • Content types = Prefix
    • select Updates
    • Condition = { "and": [{"attr": "status.value", "value": "deprecated"}]}
    • Action type = Webhook
    • Webhook = Test
  3. Create event rule 2:
    • Name = Rule 2
    • Content types = Prefix
    • select Updates
    • Condition = { "and": [{"attr": "status.value", "value": "active"}]}
    • Action type = Webhook
    • Webhook = Test
  4. Start webhook receiver (python manage.py webhook_receiver), or observe the webhooks happen in some other way

(Sorry, couldn't figure out the correct condition syntax without using the "and" operator)

Demo:

  1. Create a prefix, like 10.1.2.0/24, status = Active (the defaults)
  2. Edit the prefix: change its status to Deprecated
  3. Edit the prefix again: change its status to Active

Expected Behavior

Webhook is run twice: first when prefix status was changed to Deprecated (step 6), second when changed to Active again (step 7).

Observed Behavior

Webhook is run only once, that's in step 6, but not in step 7.

Additionally: If Rule 1 is disabled, and steps 6 and 7 are executed again, now the webhook is run in step 7.

Looks like only the first enabled event rule is run for a specific object type.

Originally created by @markkuleinio on GitHub (Jan 17, 2024). Originally assigned to: @jeremystretch on GitHub. ### Deployment Type Self-hosted ### NetBox Version v3.7.0 ### Python Version 3.11 ### Steps to Reproduce Setup: 1. Create a webhook: Name = Test, URL = http://127.0.0.1:9000 2. Create event rule 1: - Name = Rule 1 - Content types = Prefix - select Updates - Condition = `{ "and": [{"attr": "status.value", "value": "deprecated"}]}` - Action type = Webhook - Webhook = Test 3. Create event rule 2: - Name = Rule 2 - Content types = Prefix - select Updates - Condition = `{ "and": [{"attr": "status.value", "value": "active"}]}` - Action type = Webhook - Webhook = Test 4. Start webhook receiver (`python manage.py webhook_receiver`), or observe the webhooks happen in some other way (Sorry, couldn't figure out the correct condition syntax without using the "and" operator) Demo: 5. Create a prefix, like 10.1.2.0/24, status = Active (the defaults) 6. Edit the prefix: change its status to **Deprecated** 7. Edit the prefix again: change its status to **Active** ### Expected Behavior Webhook is run **twice**: first when prefix status was changed to **Deprecated** (step 6), second when changed to **Active** again (step 7). ### Observed Behavior Webhook is run **only once**, that's in step 6, but not in step 7. Additionally: If Rule 1 is disabled, and steps 6 and 7 are executed again, now the webhook is run in step 7. Looks like only the first enabled event rule is run for a specific object type.
adam added the type: bugstatus: acceptedseverity: mediumtopic: event rules labels 2025-12-29 20:45:28 +01:00
adam closed this issue 2025-12-29 20:45:28 +01:00
Author
Owner

@jeremystretch commented on GitHub (Jan 17, 2024):

@adparis99 @markkuleinio thank you both for helping to track this down and for opening the bug report!

Fortunately this seems like quite a simple fix. I'll have a PR in shortly, and we should be able to ship a fix in v3.7.1.

@jeremystretch commented on GitHub (Jan 17, 2024): @adparis99 @markkuleinio thank you both for helping to track this down and for opening the bug report! Fortunately this seems like quite a simple fix. I'll have a PR in shortly, and we should be able to ship a fix in v3.7.1.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#9102