Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only one event rule triggers for a content type #14827

Closed
markkuleinio opened this issue Jan 17, 2024 · 1 comment · Fixed by #14828
Closed

Only one event rule triggers for a content type #14827

markkuleinio opened this issue Jan 17, 2024 · 1 comment · Fixed by #14828
Assignees
Labels
severity: medium Results in substantial degraded or broken functionality for specfic workflows status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@markkuleinio
Copy link
Contributor

markkuleinio commented Jan 17, 2024

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.

@markkuleinio markkuleinio added the type: bug A confirmed report of unexpected behavior in the application label Jan 17, 2024
@jeremystretch jeremystretch self-assigned this Jan 17, 2024
@jeremystretch jeremystretch added status: under review Further discussion is needed to determine this issue's scope and/or implementation severity: medium Results in substantial degraded or broken functionality for specfic workflows labels Jan 17, 2024
@jeremystretch
Copy link
Member

@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 jeremystretch added status: accepted This issue has been accepted for implementation and removed status: under review Further discussion is needed to determine this issue's scope and/or implementation labels Jan 17, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
severity: medium Results in substantial degraded or broken functionality for specfic workflows status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
2 participants