From 1aba5f9d860eb11819073b5e1669c060ec711ad2 Mon Sep 17 00:00:00 2001 From: jmoreira-valory Date: Wed, 28 Aug 2024 18:21:27 +0200 Subject: [PATCH 1/2] fix: rename instead of delete invalid services --- operate/services/manage.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/operate/services/manage.py b/operate/services/manage.py index f612cd0cf..4e357cb72 100644 --- a/operate/services/manage.py +++ b/operate/services/manage.py @@ -115,9 +115,11 @@ def json(self) -> t.List[t.Dict]: self.logger.warning( f"Failed to load service: {path.name}. Exception: {e}" ) - # delete the invalid path - shutil.rmtree(path) - self.logger.info(f"Deleted invalid service: {path.name}") + # rename the invalid path + invalid_path = path.parent / f"invalid_{path.name}" + os.rename(path, invalid_path) + self.logger.info(f"Renamed invalid service: {path.name} to {invalid_path.name}") + return data def exists(self, service: str) -> bool: From a153a4bd3c7ced673d3120378efb1161f7de464c Mon Sep 17 00:00:00 2001 From: jmoreira-valory Date: Wed, 28 Aug 2024 18:24:10 +0200 Subject: [PATCH 2/2] fix: linters --- operate/services/manage.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/operate/services/manage.py b/operate/services/manage.py index 4e357cb72..675f06ae8 100644 --- a/operate/services/manage.py +++ b/operate/services/manage.py @@ -118,7 +118,9 @@ def json(self) -> t.List[t.Dict]: # rename the invalid path invalid_path = path.parent / f"invalid_{path.name}" os.rename(path, invalid_path) - self.logger.info(f"Renamed invalid service: {path.name} to {invalid_path.name}") + self.logger.info( + f"Renamed invalid service: {path.name} to {invalid_path.name}" + ) return data