Show cmd detail when execute linux command failed

For neutron-l3-agent, after the execution of the linux command fails,
display which command failed to execute

Change-Id: Ia237e1b18e02c9da3ae9ee94e4244828e5c207b2
Closes-Bug: #1893627
This commit is contained in:
boluanace 2020-08-31 07:56:17 -07:00
parent de3cc88ac3
commit 7f494fa3ae
1 changed files with 2 additions and 0 deletions

View File

@ -132,10 +132,12 @@ def execute(cmd, process_input=None, addl_env=None,
extra_ok_codes = extra_ok_codes or []
if returncode and returncode not in extra_ok_codes:
msg = _("Exit code: %(returncode)d; "
"Cmd: %(cmd)s; "
"Stdin: %(stdin)s; "
"Stdout: %(stdout)s; "
"Stderr: %(stderr)s") % {
'returncode': returncode,
'cmd': cmd,
'stdin': process_input or '',
'stdout': _stdout,
'stderr': _stderr}