mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-01 00:03:10 +00:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user