mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Merge pull request #19633 from ether42/develop
lxc module: kwarg shadowing in run_cmd provokes unexpected return value
This commit is contained in:
commit
8d45f147bf
@ -2138,7 +2138,7 @@ def run_cmd(name, cmd, no_start=False, preserve_state=True,
|
||||
if not use_vt:
|
||||
res = __salt__['cmd.run_all'](cmd)
|
||||
else:
|
||||
stdout, stderr = '', ''
|
||||
stdout_buffer, stderr_buffer = '', ''
|
||||
try:
|
||||
proc = vt.Terminal(cmd,
|
||||
shell=True,
|
||||
@ -2158,26 +2158,26 @@ def run_cmd(name, cmd, no_start=False, preserve_state=True,
|
||||
except IOError:
|
||||
cstdout, cstderr = '', ''
|
||||
if cstdout:
|
||||
stdout += cstdout
|
||||
stdout_buffer += cstdout
|
||||
else:
|
||||
cstdout = ''
|
||||
if cstderr:
|
||||
stderr += cstderr
|
||||
stderr_buffer += cstderr
|
||||
else:
|
||||
cstderr = ''
|
||||
except KeyboardInterrupt:
|
||||
break
|
||||
res = {'retcode': proc.exitstatus,
|
||||
'pid': 2,
|
||||
'stdout': stdout,
|
||||
'stderr': stderr}
|
||||
'stdout': stdout_buffer,
|
||||
'stderr': stderr_buffer}
|
||||
except vt.TerminalException:
|
||||
trace = traceback.format_exc()
|
||||
log.error(trace)
|
||||
res = {'retcode': 127,
|
||||
'pid': '2',
|
||||
'stdout': stdout,
|
||||
'stderr': stderr}
|
||||
'stdout': stdout_buffer,
|
||||
'stderr': stderr_buffer}
|
||||
finally:
|
||||
proc.close(terminate=True, kill=True)
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user