From 7401192478c214f28d66fd07a330703a2aadb603 Mon Sep 17 00:00:00 2001 From: Eric Callahan Date: Mon, 24 Jan 2022 15:42:45 -0500 Subject: [PATCH] update_manager: store klipper paths in the database If Klipper or its python executable is located at a custom path this allows moonraker to instantiate its update on startup rather than wait for Klipper to connect. This also resolves an issue where Klipper's update state is always refreshed on startup when its located in a non-default path. Signed-off-by: Eric Callahan --- .../components/update_manager/update_manager.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/moonraker/components/update_manager/update_manager.py b/moonraker/components/update_manager/update_manager.py index 272beb6..af98d45 100644 --- a/moonraker/components/update_manager/update_manager.py +++ b/moonraker/components/update_manager/update_manager.py @@ -86,9 +86,14 @@ class UpdateManager: self.updaters: Dict[str, BaseDeploy] = {} if config.getboolean('enable_system_updates', True): self.updaters['system'] = PackageDeploy(config, self.cmd_helper) + db: DBComp = self.server.lookup_component('database') + kpath = db.get_item("moonraker", "klipper_path", + KLIPPER_DEFAULT_PATH) + kenv_path = db.get_item("moonraker", "klipper_exec", + KLIPPER_DEFAULT_EXEC) if ( - os.path.exists(KLIPPER_DEFAULT_PATH) and - os.path.exists(KLIPPER_DEFAULT_EXEC) + os.path.exists(kpath) and + os.path.exists(kenv_path) ): self.updaters['klipper'] = get_deploy_class(KLIPPER_DEFAULT_PATH)( self.app_config[f"update_manager klipper"], self.cmd_helper, @@ -206,6 +211,10 @@ class UpdateManager: ): # Current Klipper Updater is valid return + # Update paths in the database + db: DBComp = self.server.lookup_component('database') + db.insert_item("moonraker", "klipper_path", kpath) + db.insert_item("moonraker", "klipper_exec", executable) need_notification = not isinstance(kupdater, AppDeploy) self.updaters['klipper'] = get_deploy_class(kpath)( self.app_config[f"update_manager klipper"], self.cmd_helper,