Skip to content

Commit e8f368d

Browse files
committed
Disable pseudo-terminal allocation for the rsync copy backend
In cases of hanging aexpect processes it is possible that we exhaust the pseudo-terminals on the system. Disabling pseudo-terminal allocation for the rsync backend should help mitigate this issue. Signed-off-by: Plamen Dimitrov <[email protected]>
1 parent 02e782c commit e8f368d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

aexpect/remote.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ def remote_copy(
667667
Transfer files using rsync or SCP, given a command line.
668668
669669
:param command: The command to execute
670-
(e.g. "rsync -avz -e 'ssh -p 22' /local/path user@host:/remote/path"
670+
(e.g. "rsync -avz -e 'ssh -Tp 22' /local/path user@host:/remote/path"
671671
or "scp -r foobar root@localhost:/tmp/").
672672
:param password_list: Password list to send in reply to a password prompt.
673673
:param log_filename: If specified, log all output to this file
@@ -935,7 +935,7 @@ def rsync_to_remote(
935935
if directory:
936936
command += " -r"
937937
command += (
938-
f" -avz -e 'ssh -p {port} -o UserKnownHostsFile=/dev/null "
938+
f" -avz -e 'ssh -Tp {port} -o UserKnownHostsFile=/dev/null "
939939
f"-o StrictHostKeyChecking=no' {limit} "
940940
f"{quote_path(local_path)} {username}@{host}:{shlex.quote(remote_path)}"
941941
)
@@ -992,7 +992,7 @@ def rsync_from_remote(
992992
if directory:
993993
command += " -r"
994994
command += (
995-
f" -avz -e 'ssh -p {port} -o UserKnownHostsFile=/dev/null "
995+
f" -avz -e 'ssh -Tp {port} -o UserKnownHostsFile=/dev/null "
996996
f"-o StrictHostKeyChecking=no' {limit} "
997997
f"{username}@{host}:{quote_path(remote_path)} {shlex.quote(local_path)}"
998998
)

tests/test_remote.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def test_rsync_to_remote(self, mock_remote_copy):
9595
)
9696
self.assertEqual(
9797
mock_remote_copy.call_args[0][0].command,
98-
r"rsync -r -avz -e 'ssh -p 22 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' /local/path [email protected]:/remote/path",
98+
r"rsync -r -avz -e 'ssh -Tp 22 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' /local/path [email protected]:/remote/path",
9999
)
100100

101101
@mock.patch("aexpect.remote._remote_copy")
@@ -129,5 +129,5 @@ def test_rsync_from_remote(self, mock_remote_copy):
129129
)
130130
self.assertEqual(
131131
mock_remote_copy.call_args[0][0].command,
132-
r"rsync -r -avz -e 'ssh -p 22 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' [email protected]:/remote/path /local/path",
132+
r"rsync -r -avz -e 'ssh -Tp 22 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' [email protected]:/remote/path /local/path",
133133
)

0 commit comments

Comments
 (0)