From 6e3242cd65a65aa20dc4b1b3c191b1fb9c0e6efa Mon Sep 17 00:00:00 2001 From: JarbasAI <33701864+JarbasAl@users.noreply.github.com> Date: Sat, 2 Mar 2024 20:26:40 +0000 Subject: [PATCH] fix: old mycroft skills loading (#426) --- ovos_core/skill_manager.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/ovos_core/skill_manager.py b/ovos_core/skill_manager.py index d094132f869..d5dd84921c7 100644 --- a/ovos_core/skill_manager.py +++ b/ovos_core/skill_manager.py @@ -408,8 +408,6 @@ def handle_initial_training(self, message): def run(self): """Load skills and update periodically from disk and internet.""" - self._remove_git_locks() - self.load_priority() self.status.set_alive() @@ -478,14 +476,6 @@ def run(self): 'hit.') sleep(30) - def _remove_git_locks(self): - """If git gets killed from an abrupt shutdown it leaves lock files.""" - for skills_dir in get_skill_directories(): - lock_path = os.path.join(skills_dir, '*/.git/index.lock') - for i in glob(lock_path): - LOG.warning('Found and removed git lock file: ' + i) - os.remove(i) - def _load_on_network(self): LOG.info('Loading skills that require network...') self._load_new_skills(network=True, internet=False) @@ -611,7 +601,10 @@ def _load_skill(self, skill_directory): load_status = False finally: self.skill_loaders[skill_directory] = skill_loader - LOG.info(f"Loaded old style skill: {skill_directory}") + if load_status: + LOG.info(f"Loaded old style skill: {skill_directory}") + else: + LOG.error(f"Failed to load old style skill: {skill_directory}") return skill_loader if load_status else None def _unload_skill(self, skill_dir): @@ -628,7 +621,8 @@ def _get_skill_directories(self): # let's scan all valid directories, if a skill folder name exists in # more than one of these then it should override the previous skillmap = {} - for skills_dir in get_skill_directories(): + valid_skill_roots = ["/opt/mycroft/skills"] + get_skill_directories() + for skills_dir in valid_skill_roots: if not os.path.isdir(skills_dir): continue for skill_id in os.listdir(skills_dir):