summaryrefslogtreecommitdiff
path: root/kvmd/apps
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2022-06-18 13:10:00 +0300
committerMaxim Devaev <[email protected]>2022-06-18 13:10:00 +0300
commitb5344a5f3a17a5d3a354ee4d4c9894e068da6985 (patch)
tree9f9a877a3923174fee1932a528372cb9776605ff /kvmd/apps
parent53e64fe1518d7dd8d53c6e04846cee1601c2c754 (diff)
refactoring
Diffstat (limited to 'kvmd/apps')
-rw-r--r--kvmd/apps/cleanup/__init__.py4
-rw-r--r--kvmd/apps/ipmi/server.py6
-rw-r--r--kvmd/apps/kvmd/ugpio.py10
3 files changed, 10 insertions, 10 deletions
diff --git a/kvmd/apps/cleanup/__init__.py b/kvmd/apps/cleanup/__init__.py
index b58ff961..3e33d09f 100644
--- a/kvmd/apps/cleanup/__init__.py
+++ b/kvmd/apps/cleanup/__init__.py
@@ -85,12 +85,12 @@ def main(argv: Optional[List[str]]=None) -> None:
logger = get_logger(0)
logger.info("Cleaning up ...")
- for method in [
+ for func in [
_kill_streamer,
_remove_sockets,
]:
try:
- method(config)
+ func(config)
except Exception:
pass
diff --git a/kvmd/apps/ipmi/server.py b/kvmd/apps/ipmi/server.py
index 817c4a0b..597e6dce 100644
--- a/kvmd/apps/ipmi/server.py
+++ b/kvmd/apps/ipmi/server.py
@@ -161,7 +161,7 @@ class IpmiServer(BaseIpmiServer): # pylint: disable=too-many-instance-attribute
code = 0xCC # Invalid request
session.send_ipmi_response(code=code)
- def __make_request(self, session: IpmiServerSession, name: str, method_path: str, **kwargs): # type: ignore
+ def __make_request(self, session: IpmiServerSession, name: str, func_path: str, **kwargs): # type: ignore
async def runner(): # type: ignore
logger = get_logger(0)
credentials = self.__auth_manager.get_credentials(session.username.decode())
@@ -169,8 +169,8 @@ class IpmiServer(BaseIpmiServer): # pylint: disable=too-many-instance-attribute
session.sockaddr[0], name, credentials.ipmi_user, credentials.kvmd_user)
try:
async with self.__kvmd.make_session(credentials.kvmd_user, credentials.kvmd_passwd) as kvmd_session:
- method = functools.reduce(getattr, method_path.split("."), kvmd_session)
- return (await method(**kwargs))
+ func = functools.reduce(getattr, func_path.split("."), kvmd_session)
+ return (await func(**kwargs))
except (aiohttp.ClientError, asyncio.TimeoutError) as err:
logger.error("[%s]: Can't perform request %s: %s", session.sockaddr[0], name, err)
raise
diff --git a/kvmd/apps/kvmd/ugpio.py b/kvmd/apps/kvmd/ugpio.py
index cea60bb9..d4b0f16a 100644
--- a/kvmd/apps/kvmd/ugpio.py
+++ b/kvmd/apps/kvmd/ugpio.py
@@ -182,20 +182,20 @@ class _GpioOutput: # pylint: disable=too-many-instance-attributes
# =====
@aiotools.atomic
- async def __run_action(self, wait: bool, name: str, method: Callable, *args: Any) -> None:
+ async def __run_action(self, wait: bool, name: str, func: Callable, *args: Any) -> None:
if wait:
async with self.__region:
- await method(*args)
+ await func(*args)
else:
await aiotools.run_region_task(
f"Can't perform {name} of {self} or operation was not completed",
- self.__region, self.__action_task_wrapper, name, method, *args,
+ self.__region, self.__action_task_wrapper, name, func, *args,
)
@aiotools.atomic
- async def __action_task_wrapper(self, name: str, method: Callable, *args: Any) -> None:
+ async def __action_task_wrapper(self, name: str, func: Callable, *args: Any) -> None:
try:
- return (await method(*args))
+ return (await func(*args))
except GpioDriverOfflineError:
get_logger(0).error("Can't perform %s of %s or operation was not completed: driver offline", name, self)