server: skip pip recovery when the missing module is a component

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan committed 2025-03-26 05:53:25 -04:00
1 parent 1226a08176
commit b90c96524c
1 file changed
+6 -2
+6 -2
View File
@@ -302,8 +302,8 @@ class Server:
raise self.error(
f"Component {component_name} previously failed to load", 500
)
full_name = f"moonraker.components.{component_name}"
try:
full_name = f"moonraker.components.{component_name}"
module = importlib.import_module(full_name)
# Server components use the [server] section for configuration
if component_name not in SERVER_COMPONENTS:
@@ -314,7 +314,11 @@ class Server:
component = load_func(config)
except Exception as e:
ucomps: List[str] = self.app_args.get("unofficial_components", [])
if isinstance(e, ModuleNotFoundError) and component_name not in ucomps:
if (
isinstance(e, ModuleNotFoundError) and
full_name != e.name and
component_name not in ucomps
):
if self.try_pip_recovery(e.name or "unknown"):
return self.load_component(config, component_name, default)
msg = f"Unable to load component: ({component_name})"