Skip to content

Integrate maintenance events with NetBox event system (PR #20 + compatibility fixes)#21

Merged
diegogodoy06 merged 2 commits into
mainfrom
pr-20-notifications
Jun 11, 2026
Merged

Integrate maintenance events with NetBox event system (PR #20 + compatibility fixes)#21
diegogodoy06 merged 2 commits into
mainfrom
pr-20-notifications

Conversation

@diegogodoy06

Copy link
Copy Markdown
Owner

Includes #20 by @petersonbasso plus a follow-up commit fixing two compatibility issues found during testing (see #20 (comment)):

  1. Migration depended on extras.0138 (NetBox 4.6.0+ only) - now uses ('extras', 'latest') so 4.4/4.5 installs keep working.
  2. Event payload was missing the 'data' key read unconditionally by process_event_rules - maintenance_due notifications never fired from check_maintenance/CheckMaintenanceJob.

Tested end-to-end on a clean NetBox v4.6.2 (migrations, manage.py check, event types registry, due/scheduled/completed notifications, duplicate suppression, full boot).

petersonbasso and others added 2 commits May 22, 2026 10:01
- Register custom event types (maintenance_due, maintenance_scheduled, maintenance_completed) in NetBox registry
- Implement core events module to dispatch events safely within/outside HTTP request contexts
- Fire events automatically when a MaintenanceExecution is scheduled or completed
- Add CheckMaintenanceJob and check_maintenance command to periodically detect overdue plans and fire events
- Track last notified date on MaintenancePlan to prevent duplicate events
- Implement filter forms for MaintenancePlan and MaintenanceExecution
- Depend on extras __latest__ instead of pinning 0138 (ships only with
  NetBox 4.6.0), matching the plugin's other migrations; the pinned
  dependency made migrate fail with NodeNotFoundError on 4.4/4.5.
- Include data (serialize_for_event) eagerly in the event payload.
  process_event_rules reads event[data] unconditionally; without it the
  plain-dict path (NetBox <=4.5 queue fallback and the immediate-flush
  branch used by check_maintenance/CheckMaintenanceJob) raised KeyError,
  so maintenance_due notifications never fired outside a request.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@diegogodoy06 diegogodoy06 merged commit 2430107 into main Jun 11, 2026
1 check passed
@diegogodoy06 diegogodoy06 deleted the pr-20-notifications branch June 11, 2026 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants