mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 09:10:30 +08:00
removed unnecessary proc.returncode
This commit is contained in:
parent
047d8ad760
commit
04e0ad213a
@ -105,14 +105,14 @@ async def kill_process(proc: asyncio.subprocess.Process, wait: float, logger: lo
|
|||||||
if proc.returncode is not None:
|
if proc.returncode is not None:
|
||||||
raise
|
raise
|
||||||
await proc.wait()
|
await proc.wait()
|
||||||
logger.info("Process killed: pid=%d; retcode=%d", proc.pid, proc.returncode)
|
logger.info("Process killed: retcode=%d", proc.pid, proc.returncode)
|
||||||
except asyncio.CancelledError:
|
except asyncio.CancelledError:
|
||||||
pass
|
pass
|
||||||
except Exception:
|
except Exception:
|
||||||
if proc.returncode is None:
|
if proc.returncode is None:
|
||||||
logger.exception("Can't kill process pid=%d", proc.pid)
|
logger.exception("Can't kill process pid=%d", proc.pid)
|
||||||
else:
|
else:
|
||||||
logger.info("Process killed: pid=%d; retcode=%d", proc.pid, proc.returncode)
|
logger.info("Process killed: retcode=%d", proc.pid, proc.returncode)
|
||||||
|
|
||||||
|
|
||||||
def rename_process(suffix: str, prefix: str="kvmd") -> None:
|
def rename_process(suffix: str, prefix: str="kvmd") -> None:
|
||||||
|
|||||||
@ -81,7 +81,7 @@ class Plugin(BaseUserGpioDriver): # pylint: disable=too-many-instance-attribute
|
|||||||
try:
|
try:
|
||||||
proc = await aioproc.log_process(self.__cmd, logger=get_logger(0), prefix=str(self))
|
proc = await aioproc.log_process(self.__cmd, logger=get_logger(0), prefix=str(self))
|
||||||
if proc.returncode != 0:
|
if proc.returncode != 0:
|
||||||
raise RuntimeError(f"Custom command error: pid={proc.pid}; retcode={proc.returncode}")
|
raise RuntimeError(f"Custom command error: retcode={proc.returncode}")
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
get_logger(0).error("Can't run custom command %s: %s", self.__cmd, tools.efmt(err))
|
get_logger(0).error("Can't run custom command %s: %s", self.__cmd, tools.efmt(err))
|
||||||
raise GpioDriverOfflineError(self)
|
raise GpioDriverOfflineError(self)
|
||||||
|
|||||||
@ -155,7 +155,7 @@ class Plugin(BaseUserGpioDriver): # pylint: disable=too-many-instance-attribute
|
|||||||
try:
|
try:
|
||||||
proc = await aioproc.log_process(**self.__make_ipmitool_kwargs(action), logger=get_logger(0), prefix=str(self))
|
proc = await aioproc.log_process(**self.__make_ipmitool_kwargs(action), logger=get_logger(0), prefix=str(self))
|
||||||
if proc.returncode != 0:
|
if proc.returncode != 0:
|
||||||
raise RuntimeError(f"Ipmitool error: pid={proc.pid}; retcode={proc.returncode}")
|
raise RuntimeError(f"Ipmitool error: retcode={proc.returncode}")
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
get_logger(0).error("Can't send IPMI power-%s request to %s:%d: %s",
|
get_logger(0).error("Can't send IPMI power-%s request to %s:%d: %s",
|
||||||
action, self.__host, self.__port, tools.efmt(err))
|
action, self.__host, self.__port, tools.efmt(err))
|
||||||
@ -167,7 +167,7 @@ class Plugin(BaseUserGpioDriver): # pylint: disable=too-many-instance-attribute
|
|||||||
try:
|
try:
|
||||||
(proc, text) = await aioproc.read_process(**self.__make_ipmitool_kwargs("status"))
|
(proc, text) = await aioproc.read_process(**self.__make_ipmitool_kwargs("status"))
|
||||||
if proc.returncode != 0:
|
if proc.returncode != 0:
|
||||||
raise RuntimeError(f"Ipmitool error: pid={proc.pid}; retcode={proc.returncode}")
|
raise RuntimeError(f"Ipmitool error: retcode={proc.returncode}")
|
||||||
stripped = text.strip()
|
stripped = text.strip()
|
||||||
if stripped.startswith("Chassis Power is "):
|
if stripped.startswith("Chassis Power is "):
|
||||||
self.__power = (stripped != "Chassis Power is off")
|
self.__power = (stripped != "Chassis Power is off")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user