ansible/ansible — pull request #1801 by dagwieers (2012-12-24 01:41:56+00:00)
Title: Disable pseudo tty's by default, unless explicitely asked (or when using sudo)

After extensive testing I concluded that using `ssh -tt` is hurting raw commands (and if script uses raw, also script). The reason is that `ssh -tt` causes all output going to stdout, rather than separating stdout and stderr.

You can check by doing:

$ ssh -q -tt ls /dag/ >/dev/null
$

which gives no output because stderr goes straight into /dev/null, contrary to:

$ ssh -q -T ls /dag/ >/dev/null
ls: cannot access /dag/: No such file or directory
$

For normal command/shell actions, the output is processed beforehand and returned through json, but this is not possible for raw commands (that do not require python). Besides anything run using remote modules has effectively pseudo tty's disabled anyhow (!).

What's more, when using pseudo tty's when running something remotelyi (using raw), it is possible that some process behaves differently (e.g. menu system or something requiring input). We have seen problems with installers hanging indefinitely because of pseudo tty's where it would work fine outside of Ansible using shmux. I don't think any of the parallel shells use pseudo tty's.

So the included patch disables pseudo tty's by default, except when explicitely asked for using `pty=yes` or when using sudo (is this needed and when ?). We also enable pseudo tty's by default when using sudo (however, I think we should re-evaluate this and confirm when exactly this is needed).

Another reason for disabling pseudo tty's is that when using local or fireball transport, no pseudo tty's have been available (ever). We can implement this as well, if necessary, but this enforces the fact that at the moment different transports are doing it differently, and even for command, shell and script pseudo tty's were effectively disabled (through Popen).

So if some transports don't have pseudo tty's, and most of the action (command, shell, script) were not using them either, the question begs, who needs them ? And do we want to make them available across the board ? (i.e. using raw/script with `pty=yes` on fireball/local, or using command/shell with `pty=yes` on all transports).

I don't mind cleaning this up.