Repository navigation
fix(integrations): make the SES inbound function work with NetBox 4 - #104
Merged
Merged
Conversation
The inbound function looked up content types at /api/extras/content-types/, which NetBox 4.0 moved to /api/core/object-types/, so every parsed email failed after its maintenance was created and before any impact or notification was stored. Also match maintenances by ID and provider, circuits by exact CID within the provider, and impacts by event and target type; skip impact changes on completed or cancelled maintenances, which the plugin refuses; store each email's notification once so Lambda retries are safe; record every maintenance in an email; truncate to model limits; match sender domains exactly or by subdomain; read non-UTF-8 email. Add unit tests that run real BCOP notifications through circuit-maintenance-parser against an in-memory NetBox API, a CI job for them, and ruff coverage of integrations/. Remove parsers/aws-sns-lambda, which targeted the netbox-circuitmaintenance API and cannot work with this plugin, and its docs page.
…tices A notice without a status (circuit-maintenance-parser's NO-CHANGE, used by status-less BCOP and Cogent notices and by reminders) was sent to NetBox, which refuses it; it now keeps the existing status or creates the maintenance as UNKNOWN. A blank subject or a calendar-only body no longer fails validation, the maintenance ID is cut to the model limit, non-UTF-8 mail is handed to the parser already decoded, the most specific provider domain wins, and S3 errors raise so Lambda retries them. The test fake now validates writes as the plugin's serializers do. Docs that still looked up /api/extras/content-types/ now use /api/core/object-types/, and the README states the ordering, concurrency and dead-letter limits instead of promising every step is safe.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Summary
parsers/aws-sns-lambda/still called thenetbox-circuitmaintenanceAPI (plugins.maintenance.circuitmaintenance), so it could not work with this plugin. Its intended replacement, the inbound function of the AWS SES integration, did not work on NetBox 4 either. It looked up content types at/api/extras/content-types/, which NetBox 4.0 moved to/api/core/object-types/. Every parsed email therefore failed after its maintenance was created and before any impact or notification was stored.This PR fixes the inbound function, tests it, and removes the legacy parser.
Inbound function fixes
/api/core/object-types/and cached per container.cid__ie) within that provider.*_content_type_idparams don't exist, and django-filter silently ignored them.NO-CHANGE: status-less BCOP and Cogent notices, reminders) keep the existing status, or create the maintenance asUNKNOWN. Before, NetBox rejected them.bso.cono longer matchesbso.com.Tests and CI
integrations/aws-ses/tests/(27 tests) runs real BCOP iCal notifications throughcircuit-maintenance-parseragainst an in-memory NetBox API. The fake validates writes the way the plugin's serializers do, so a payload NetBox would reject with 400 fails the test.ruffnow also coversintegrations/, which needed a one-lineUP017fix in the outbound handler.Docs
parsers/aws-sns-lambda/, its docs page and its screenshots.parsers.mdnow points to the SES integration./api/extras/content-types/. Both now use/api/core/object-types/.Test plan
pytest -o addopts="" integrations/aws-ses/tests: 27 passed (clean Python 3.12 venv, same as the CI job)ruff check/ruff format --checkonnotices tests integrationszensical build: no warnings