Don't use -tt for ssh connections when sudoable=False

Due to an apparent race condition while using pty's on a heavily loaded
system, rarely a request to create a temp directory returns an empty
string rather than the newly created path, causing an error. Disabling
forced pty's appears to resolve the issue, so this patch modifies the
mkdtemp remote call not use -tt as we're not escalating privileges and
thus no pty is required.

Fixes #13876
This commit is contained in:
James Cammarata 2016-04-11 23:19:12 -04:00
parent 6a97d6386f
commit 44877b7c7e

View file

@ -559,11 +559,12 @@ class Connection(ConnectionBase):
# python interactive-mode but the modules are not compatible with the
# interactive-mode ("unexpected indent" mainly because of empty lines)
if in_data:
cmd = self._build_command('ssh', self.host, cmd)
if not in_data and sudoable:
args = ('ssh', '-tt', self.host, cmd)
else:
cmd = self._build_command('ssh', '-tt', self.host, cmd)
args = ('ssh', self.host, cmd)
cmd = self._build_command(*args)
(returncode, stdout, stderr) = self._run(cmd, in_data, sudoable=sudoable)
return (returncode, stdout, stderr)