fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fab-user] combine_stderr is not separating stderr and stdout


From: cruxpot
Subject: [Fab-user] combine_stderr is not separating stderr and stdout
Date: Wed, 24 Feb 2016 14:01:37 -0600

I'm having an issue getting run and sudo to separate the streams which is causing issues particularly where sudo presents a first time "lecture" banner or an error before it runs the command and produces expected output. In this case, the sudo error is a resolution error on a debian 7 host running 'whoami'. I have set env.combine_stderr globally (env set at beginning), "with settings" and as a kwargs argument for sudo(). Same result, everything goes to stdout no matter I do. 

combine_stderr: 'False'
address@hidden:22] sudo: busybox whoami
address@hidden:22] out: sudo: unable to resolve host debian7_x64
address@hidden:22] out: sudo password:
address@hidden:22] out: root
address@hidden:22] out:
cmd: 'sudo -S -p 'sudo password:'  bash -l -c "cd /tmp/tmpdir2 >/dev/null && export PATH=\"\".:/tmp/tmpdir2:/bin:/usr/bin\"\" && whoami"' SUCCEEDED with return code: '0', output:
sudo: unable to resolve host debian7_x64


Return values (result.stdout and result.stderr) are:

stdout: 'sudo: unable to resolve host debian7_x64

root'
stderr: ''

The "unable to resolve host" should go into stderr and I have confirmed this manually on a shell that it is in fact stderr. Why is this not working? It causes parsing issues as I want to discard the error output. I know the box is misconfigured but that is on purpose (simply remove its host definition in /etc/hosts).

Code:
 with settings(combine_stderr=False):
     logger.debug("combine_stderr: '%s'" % env.combine_stderr)
     result = sudo(cmd, combine_stderr=False)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]