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 <arksine.code@gmail.com>
This commit is contained in:
parent
261fbbc867
commit
1c248d1de8
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue