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
pull/15377/head
James Cammarata 9 years ago
parent 6a97d6386f
commit 44877b7c7e

@ -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)

Loading…
Cancel
Save