Lint py files

This commit is contained in:
Théophile Diot 2023-08-31 16:50:16 +02:00
parent 656c5008de
commit 47bf7299a1
No known key found for this signature in database
GPG key ID: 248FEA4BAE400D06
5 changed files with 35 additions and 10 deletions

View file

@ -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(

View file

@ -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()

View file

@ -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()

View file

@ -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:

View file

@ -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: