update_manager: refactor extension instantation
Don't allow extension errors to propagate, warn and continue loading the module instead. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
238b08ea1f
commit
72a85e08d4
|
@ -106,17 +106,25 @@ class UpdateManager:
|
||||||
cfg = config[section]
|
cfg = config[section]
|
||||||
name = section.split()[-1]
|
name = section.split()[-1]
|
||||||
if name in self.updaters:
|
if name in self.updaters:
|
||||||
raise config.error(f"Client repo {name} already added")
|
self.server.add_warning(
|
||||||
client_type = cfg.get("type")
|
f"[update_manager]: Extension {name} already added"
|
||||||
if client_type in ["web", "web_beta"]:
|
)
|
||||||
self.updaters[name] = WebClientDeploy(cfg, self.cmd_helper)
|
continue
|
||||||
elif client_type in ["git_repo", "zip", "zip_beta"]:
|
try:
|
||||||
path = os.path.expanduser(cfg.get('path'))
|
client_type = cfg.get("type")
|
||||||
dclass = get_deploy_class(path)
|
if client_type in ["web", "web_beta"]:
|
||||||
self.updaters[name] = dclass(cfg, self.cmd_helper)
|
self.updaters[name] = WebClientDeploy(cfg, self.cmd_helper)
|
||||||
else:
|
elif client_type in ["git_repo", "zip", "zip_beta"]:
|
||||||
raise config.error(
|
path = os.path.expanduser(cfg.get('path'))
|
||||||
f"Invalid type '{client_type}' for section [{section}]")
|
dclass = get_deploy_class(path)
|
||||||
|
self.updaters[name] = dclass(cfg, self.cmd_helper)
|
||||||
|
else:
|
||||||
|
self.server.add_warning(
|
||||||
|
f"Invalid type '{client_type}' for section [{section}]")
|
||||||
|
except Exception as e:
|
||||||
|
self.server.add_warning(
|
||||||
|
f"[update_manager]: Failed to load extension {name}: {e}"
|
||||||
|
)
|
||||||
|
|
||||||
self.cmd_request_lock = asyncio.Lock()
|
self.cmd_request_lock = asyncio.Lock()
|
||||||
self.klippy_identified_evt: Optional[asyncio.Event] = None
|
self.klippy_identified_evt: Optional[asyncio.Event] = None
|
||||||
|
|
Loading…
Reference in New Issue