diff options
author | Devaev Maxim <[email protected]> | 2021-04-09 06:28:58 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2021-04-09 06:28:58 +0300 |
commit | e39f3d46d89bad2a91c0c9680b84a3d2ef73fc24 (patch) | |
tree | 67756f9d7f8ea2f840db886d4c784fe70cc2e605 /kvmd | |
parent | 1ca341069d81a536c95c20467e21c983057af35f (diff) |
refactoring
Diffstat (limited to 'kvmd')
-rw-r--r-- | kvmd/plugins/ugpio/ipmi.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/kvmd/plugins/ugpio/ipmi.py b/kvmd/plugins/ugpio/ipmi.py index 794912bd..cdb317de 100644 --- a/kvmd/plugins/ugpio/ipmi.py +++ b/kvmd/plugins/ugpio/ipmi.py @@ -148,9 +148,10 @@ class Plugin(BaseUserGpioDriver): # pylint: disable=too-many-instance-attribute try: proc = await aioproc.log_process(**self.__make_ipmitool_kwargs(action), logger=get_logger(0)) if proc.returncode != 0: - raise RuntimeError(f"Error while ipmitool execution: pid={proc.pid}; retcode={proc.returncode}") + raise RuntimeError(f"Ipmitool error: pid={proc.pid}; retcode={proc.returncode}") except Exception as err: - get_logger(0).error("Can't send IPMI power-%s request to %s:%d: %s", action, self.__host, self.__port, tools.efmt(err)) + get_logger(0).error("Can't send IPMI power-%s request to %s:%d: %s", + action, self.__host, self.__port, tools.efmt(err)) raise GpioDriverOfflineError(self) # ===== @@ -159,7 +160,7 @@ class Plugin(BaseUserGpioDriver): # pylint: disable=too-many-instance-attribute try: (proc, text) = await aioproc.read_process(**self.__make_ipmitool_kwargs("status")) if proc.returncode != 0: - raise RuntimeError(f"Error while ipmitool execution: pid={proc.pid}; retcode={proc.returncode}") + raise RuntimeError(f"Ipmitool error: pid={proc.pid}; retcode={proc.returncode}") stripped = text.strip() if stripped.startswith("Chassis Power is "): self.__power = (stripped != "Chassis Power is off") @@ -167,7 +168,8 @@ class Plugin(BaseUserGpioDriver): # pylint: disable=too-many-instance-attribute return raise RuntimeError(f"Invalid ipmitool response: {text}") except Exception as err: - get_logger(0).error("Can't fetch IPMI power status from %s:%d: %s", self.__host, self.__port, tools.efmt(err)) + get_logger(0).error("Can't fetch IPMI power status from %s:%d: %s", + self.__host, self.__port, tools.efmt(err)) self.__power = False self.__online = False @@ -184,7 +186,11 @@ class Plugin(BaseUserGpioDriver): # pylint: disable=too-many-instance-attribute ) for part in self.__cmd ], - "env": ({self.__passwd_env: self.__passwd} if self.__passwd and self.__passwd_env else None), + "env": ( + {self.__passwd_env: self.__passwd} + if self.__passwd and self.__passwd_env + else None + ), } def __str__(self) -> str: |