udm-wan-monitor: fix runtime imports in detail and test routes#11
Merged
itsDNNS merged 2 commits intoJul 27, 2026
Merged
Conversation
DOCSight loads a community module's routes.py via spec_from_file_location as a synthetic top-level module (community_modules.<dir>.routes) without registering parent packages, so every 'from .collector import ...' inside the route handlers raises ModuleNotFoundError at request time. This broke POST /api/udm-wan/test (Test connection button) and GET /api/udm-wan/status with a 500 for all users. Replace the relative imports with a _collector_mod() helper that reuses the collector module DOCSight already imported (app.modules.<dir>.collector) or loads the sibling collector.py directly. Bump version to 3.1.4.
Owner
|
Thanks for the submission and for tracking down the runtime import issue in the UDM WAN Monitor. The fix is now merged, with regression coverage for the loader path. Much appreciated! |
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
DOCSight loads community routes and collectors under different synthetic module names. Relative imports from
routes.pytherefore fail at request time in the configuration-dependent routes.User impact
GET /api/udm-wan/detailandPOST /api/udm-wan/testno longer return HTTP 500 because ofModuleNotFoundError. The cached/api/udm-wan/statusroute was not affected.Verification
python3 -m unittest discover -s tests -q(8 tests)python3 scripts/validate_registry.pypython3 -m py_compile udm-wan-monitor/routes.py udm-wan-monitor/collector.py