1
0
Fork 0

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 <kennethdsouza94@gmail.com>
This commit is contained in:
Kenneth D'souza 2023-10-24 09:45:04 +05:30
parent 670541d273
commit f7f9c0dedb

View file

@ -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: