mitchellh/vagrant-rackspace — pull request #48 by maxlinc (2013-10-31 21:27:21+00:00)
Title: requiretty workaround

@kyle - this is a workaround I for the tty issues (https://github.com/mitchellh/vagrant-rackspace/issues/46, https://github.com/mitchellh/vagrant-rackspace/pull/12, etc).

It's definitely just a workaround, not a long-term solution. It basically uses the Fog connection (which has a tty) to upload and execute a script that adds the !requiretty option to the sudoers file before running any actions that use sudo over the vagrant connection.

There have been a few TTY issues opened against vagrant in the past, but it looks there are not plans to suppor it. @mitchell explained on https://github.com/mitchellh/vagrant/pull/1762#issuecomment-19175406:

> Ah, the problem is that actually breaks a lot of core internal parts of Vagrant because once you request a TTY you lose ALL access to things such as exit codes, stderr (it all appears as stdout), etc. Instead, the solution is to use scripts that specifically don't require a TTY, or fake a TTY deeper in your scripts (using stty or something).

The Fog::SSH class does appear to support of these things, though I haven't tested how well it separates stdout vs stderr.