Integrate maintenance events with NetBox event system (PR #20 + compatibility fixes)#21
Merged
Conversation
- 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Includes #20 by @petersonbasso plus a follow-up commit fixing two compatibility issues found during testing (see #20 (comment)):
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).