From 47bf7299a17ef3ebcf34e55ea1b30c5147eff484 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Diot?= Date: Thu, 31 Aug 2023 16:50:16 +0200 Subject: [PATCH] Lint py files --- src/autoconf/Config.py | 7 ++++--- src/autoconf/DockerController.py | 7 ++++++- src/autoconf/IngressController.py | 7 ++++++- src/autoconf/SwarmController.py | 7 ++++++- src/common/db/Database.py | 17 +++++++++++++---- 5 files changed, 35 insertions(+), 10 deletions(-) diff --git a/src/autoconf/Config.py b/src/autoconf/Config.py index 8c2e3191d..434d92ef4 100644 --- a/src/autoconf/Config.py +++ b/src/autoconf/Config.py @@ -63,8 +63,7 @@ class Config(ConfigCaller): "instances": False, "services": False, "configs": False, - "config": False - + "config": False, } changes = [] if instances != self.__instances or first: @@ -142,7 +141,9 @@ class Config(ConfigCaller): ) # save custom configs to database if updates["configs"]: - err = self._db.save_custom_configs(custom_configs, "autoconf", changed=False) + err = self._db.save_custom_configs( + custom_configs, "autoconf", changed=False + ) if err: success = False self.__logger.error( diff --git a/src/autoconf/DockerController.py b/src/autoconf/DockerController.py index b1ca49323..21de3a80d 100644 --- a/src/autoconf/DockerController.py +++ b/src/autoconf/DockerController.py @@ -106,7 +106,12 @@ class DockerController(Controller): return configs def apply_config(self) -> bool: - return self.apply(self._instances, self._services, configs=self._configs, first=not self._loaded) + return self.apply( + self._instances, + self._services, + configs=self._configs, + first=not self._loaded, + ) def process_events(self): self._set_autoconf_load_db() diff --git a/src/autoconf/IngressController.py b/src/autoconf/IngressController.py index 44df8452f..d7c6660a5 100644 --- a/src/autoconf/IngressController.py +++ b/src/autoconf/IngressController.py @@ -298,7 +298,12 @@ class IngressController(Controller): sleep(10) def apply_config(self) -> bool: - return self.apply(self._instances, self._services, configs=self._configs, first=not self._loaded) + return self.apply( + self._instances, + self._services, + configs=self._configs, + first=not self._loaded, + ) def process_events(self): self._set_autoconf_load_db() diff --git a/src/autoconf/SwarmController.py b/src/autoconf/SwarmController.py index 05d0b796d..7d1535334 100644 --- a/src/autoconf/SwarmController.py +++ b/src/autoconf/SwarmController.py @@ -127,7 +127,12 @@ class SwarmController(Controller): return configs def apply_config(self) -> bool: - return self.apply(self._instances, self._services, configs=self._configs, first=not self._loaded) + return self.apply( + self._instances, + self._services, + configs=self._configs, + first=not self._loaded, + ) def __event(self, event_type): while True: diff --git a/src/common/db/Database.py b/src/common/db/Database.py index 81bef5100..aae43b994 100644 --- a/src/common/db/Database.py +++ b/src/common/db/Database.py @@ -329,7 +329,9 @@ class Database: except BaseException: return format_exc() - def checked_changes(self, changes: Optional[List[str]] = None, value: Optional[bool] = False) -> str: + def checked_changes( + self, changes: Optional[List[str]] = None, value: Optional[bool] = False + ) -> str: """Set changed bit for config, custom configs, instances and plugins""" changes = changes or [ "config", @@ -470,7 +472,9 @@ class Database: return True, "" - def save_config(self, config: Dict[str, Any], method: str, changed: Optional[bool] = True) -> str: + def save_config( + self, config: Dict[str, Any], method: str, changed: Optional[bool] = True + ) -> str: """Save the config in the database""" to_put = [] with self.__db_session() as session: @@ -733,7 +737,10 @@ class Database: return "" def save_custom_configs( - self, custom_configs: List[Dict[str, Tuple[str, List[str]]]], method: str, changed: Optional[bool] = True + self, + custom_configs: List[Dict[str, Tuple[str, List[str]]]], + method: str, + changed: Optional[bool] = True, ) -> str: """Save the custom configs in the database""" message = "" @@ -1750,7 +1757,9 @@ class Database: return "" - def update_instances(self, instances: List[Dict[str, Any]], changed: Optional[bool] = True) -> str: + def update_instances( + self, instances: List[Dict[str, Any]], changed: Optional[bool] = True + ) -> str: """Update instances.""" to_put = [] with self.__db_session() as session: