From 1c248d1de8fe6b6df462c982d8c2b6fb90bc565b Mon Sep 17 00:00:00 2001 From: Arksine Date: Wed, 26 May 2021 14:32:25 -0400 Subject: [PATCH] moonraker: remove check for component existence in "load_component()" The importlib module will raise an exception if the component does not exist, so the check is redundant. This allow allows packages to be loaded. Signed-off-by: Eric Callahan --- moonraker/moonraker.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/moonraker/moonraker.py b/moonraker/moonraker.py index 4fe8850..386a1c0 100755 --- a/moonraker/moonraker.py +++ b/moonraker/moonraker.py @@ -184,16 +184,6 @@ class Server: ) -> Union[_T, Any]: if component_name in self.components: return self.components[component_name] - # Make sure component exists - mod_path = os.path.join( - os.path.dirname(__file__), 'components', component_name + '.py') - if not os.path.exists(mod_path): - msg = f"Component ({component_name}) does not exist" - logging.info(msg) - self.failed_components.append(component_name) - if isinstance(default, SentinelClass): - raise ServerError(msg) - return default try: module = importlib.import_module("components." + component_name) func_name = "load_component"