diff options
Diffstat (limited to 'kvmd')
-rw-r--r-- | kvmd/aioproc.py | 5 | ||||
-rw-r--r-- | kvmd/plugins/ugpio/cmd.py | 2 | ||||
-rw-r--r-- | kvmd/plugins/ugpio/ipmi.py | 2 |
3 files changed, 6 insertions, 3 deletions
diff --git a/kvmd/aioproc.py b/kvmd/aioproc.py index 37b44e5c..57ae0f85 100644 --- a/kvmd/aioproc.py +++ b/kvmd/aioproc.py @@ -67,13 +67,16 @@ async def log_process( cmd: List[str], logger: logging.Logger, env: Optional[Dict[str, str]]=None, + prefix: str="", ) -> asyncio.subprocess.Process: # pylint: disable=no-member (proc, stdout) = await read_process(cmd, env=env) if stdout: log = (logger.info if proc.returncode == 0 else logger.error) + if prefix: + prefix += " " for line in stdout.split("\n"): - log("=> %s", line) + log("%s=> %s", prefix, line) return proc diff --git a/kvmd/plugins/ugpio/cmd.py b/kvmd/plugins/ugpio/cmd.py index 6fa28409..7e549f1a 100644 --- a/kvmd/plugins/ugpio/cmd.py +++ b/kvmd/plugins/ugpio/cmd.py @@ -79,7 +79,7 @@ class Plugin(BaseUserGpioDriver): # pylint: disable=too-many-instance-attribute return try: - proc = await aioproc.log_process(self.__cmd, logger=get_logger(0)) + proc = await aioproc.log_process(self.__cmd, logger=get_logger(0), prefix=str(self)) if proc.returncode != 0: raise RuntimeError(f"Custom command error: pid={proc.pid}; retcode={proc.returncode}") except Exception as err: diff --git a/kvmd/plugins/ugpio/ipmi.py b/kvmd/plugins/ugpio/ipmi.py index d61b145d..eb60f0d2 100644 --- a/kvmd/plugins/ugpio/ipmi.py +++ b/kvmd/plugins/ugpio/ipmi.py @@ -153,7 +153,7 @@ class Plugin(BaseUserGpioDriver): # pylint: disable=too-many-instance-attribute return action = (_OUTPUTS[pin] if pin.isdigit() else pin) try: - proc = await aioproc.log_process(**self.__make_ipmitool_kwargs(action), logger=get_logger(0)) + proc = await aioproc.log_process(**self.__make_ipmitool_kwargs(action), logger=get_logger(0), prefix=str(self)) if proc.returncode != 0: raise RuntimeError(f"Ipmitool error: pid={proc.pid}; retcode={proc.returncode}") except Exception as err: |