[PR #11566] [MERGED] Fixes #11267: Avoid catching ImportError exceptions when loading plugins #13815

Closed
opened 2025-12-29 23:20:57 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/11566
Author: @jeremystretch
Created: 1/23/2023
Status: Merged
Merged: 1/27/2023
Merged by: @jeremystretch

Base: developHead: 11267-plugin-imports


📝 Commits (2)

  • a702a29 Avoid catching ImportErrors when loading plugin URLs
  • 20afe92 Avoid catching ImportErrors when loading plugin resources

📊 Changes

2 files changed (+42 additions, -41 deletions)

View changed files

📝 netbox/extras/plugins/__init__.py (+36 -34)
📝 netbox/extras/plugins/urls.py (+6 -7)

📄 Description

Fixes: #11267

  • Employ module_has_submodule() to check for presence of plugin URL patterns
  • Remove default paths from PluginConfig class
  • If plugin resource path has not been explicitly set, use find_spec() to check default path before importing

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/11566 **Author:** [@jeremystretch](https://github.com/jeremystretch) **Created:** 1/23/2023 **Status:** ✅ Merged **Merged:** 1/27/2023 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop` ← **Head:** `11267-plugin-imports` --- ### 📝 Commits (2) - [`a702a29`](https://github.com/netbox-community/netbox/commit/a702a29c6fa0e929db1f97e53a90a156b281326c) Avoid catching ImportErrors when loading plugin URLs - [`20afe92`](https://github.com/netbox-community/netbox/commit/20afe926f6f7cf410a9666746652adc6fded031d) Avoid catching ImportErrors when loading plugin resources ### 📊 Changes **2 files changed** (+42 additions, -41 deletions) <details> <summary>View changed files</summary> 📝 `netbox/extras/plugins/__init__.py` (+36 -34) 📝 `netbox/extras/plugins/urls.py` (+6 -7) </details> ### 📄 Description ### Fixes: #11267 - Employ `module_has_submodule()` to check for presence of plugin URL patterns - Remove default paths from PluginConfig class - If plugin resource path has not been explicitly set, use `find_spec()` to check default path before importing --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 23:20:57 +01:00
adam closed this issue 2025-12-29 23:20:57 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#13815