Return 503 from portadmin commit_configuration#3801
Merged
lunkwill42 merged 3 commits into5.17.xfrom Feb 27, 2026
Merged
Conversation
NAV/PortAdmin is changing to return 503 for expected operational errors like unreachable devices. These are already logged by NAV's own loggers, so the Django `mail_admins` handler emails are redundant noise. The `Suppress503` filter is wired into the default `mail_admins` logging handler so that records with `status_code=503` are silently dropped.
Errors in `commit_configuration` — unreachable device, unsupported commit, missing handler — are expected operational failures, not application bugs. Returning 500 triggered unnecessary admin error emails (with zero Traceback information) and misrepresented the nature of the problem. All error paths now return 503 with a descriptive message body.
|
commit_configuration
Test results 20 files 20 suites 24m 50s ⏱️ Results for commit cd31491. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 5.17.x #3801 +/- ##
==========================================
+ Coverage 63.37% 63.42% +0.05%
==========================================
Files 619 619
Lines 45871 45881 +10
Branches 43 43
==========================================
+ Hits 29071 29101 +30
+ Misses 16790 16770 -20
Partials 10 10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Member
Author
That's weird, I can't see anything weird about them 😁 |
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.




Scope and purpose
PortAdmin's
commit_configurationendpoint returned 500 for expected operational errors (unreachable device, unsupported commit, missing management handler). This would trigger unnecessary Django admin error emails with empty tracebacks that misrepresented the nature of the problem.This PR changes those error paths to return 503 with descriptive messages, and adds a
Suppress503logging filter so that 503 responses don't generate admin emails.This pull request
adds/changes/removes a dependencychanges the databasechanges the APIContributor Checklist
Added/changed documentation<major>.<minor>.x). For a new feature or other additions, it should be based onmaster.If applicable: Created new issues if this PR does not fix the issue completely/there is further work to be doneIf this results in changes in the UI: Added screenshots of the before and afterHow to observe
Trigger the commit endpoint for a device that is unreachable or doesn't support config commits. Previously this returned an HTTP 500 with an empty body; now it returns 503 with a message like
Error committing configuration on <netbox>: <reason>. The Djangomail_adminshandler will no longer send emails for these 503 responses.