From f7f9c0dedbd6677277de000ada4877d88bc145bf Mon Sep 17 00:00:00 2001 From: Kenneth D'souza Date: Tue, 24 Oct 2023 09:45:04 +0530 Subject: [PATCH] RHEL-3689: Print all arguments of failing command in err_msg Improve error log by printing all arguments passed to command. This helps in troubleshooting issues where just knowing the command is not enough, we need more details on which settings, devices and options has caused this error. Signed-off-by: Kenneth D'souza --- tuned/utils/commands.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tuned/utils/commands.py b/tuned/utils/commands.py index 177474e..94bee17 100644 --- a/tuned/utils/commands.py +++ b/tuned/utils/commands.py @@ -235,13 +235,13 @@ class commands: err_out = err[:-1] if len(err_out) == 0: err_out = out[:-1] - err_msg = "Executing %s error: %s" % (args[0], err_out) + err_msg = "Executing '%s' error: %s" % (' '.join(args), err_out) if not return_err: self._error(err_msg) except (OSError, IOError) as e: retcode = -e.errno if e.errno is not None else -1 if not abs(retcode) in no_errors and not 0 in no_errors: - err_msg = "Executing %s error: %s" % (args[0], e) + err_msg = "Executing '%s' error: %s" % (' '.join(args), e) if not return_err: self._error(err_msg) if return_err: