@@ -199,7 +199,7 @@ def test_client_join_stdout(self):
199
199
self .assertTrue (len (_output ) == len (output ))
200
200
201
201
def test_pssh_client_no_stdout_non_zero_exit_code_immediate_exit (self ):
202
- output = self .client .run_command ('exit 1' , return_list = True )
202
+ output = self .client .run_command ('exit 1' )
203
203
expected_exit_code = 1
204
204
self .client .join (output )
205
205
exit_code = output [0 ].exit_code
@@ -209,7 +209,7 @@ def test_pssh_client_no_stdout_non_zero_exit_code_immediate_exit(self):
209
209
expected_exit_code ,))
210
210
211
211
def test_pssh_client_no_stdout_non_zero_exit_code_immediate_exit_no_join (self ):
212
- output = self .client .run_command ('exit 1' , return_list = True )
212
+ output = self .client .run_command ('exit 1' )
213
213
expected_exit_code = 1
214
214
for host_out in output :
215
215
for line in host_out .stdout :
@@ -891,7 +891,7 @@ def test_identical_hosts_in_host_list(self):
891
891
client = ParallelSSHClient (hosts , port = self .port ,
892
892
pkey = self .user_key ,
893
893
num_retries = 1 )
894
- output = client .run_command (self .cmd , stop_on_errors = False , return_list = True )
894
+ output = client .run_command (self .cmd , stop_on_errors = False )
895
895
client .join (output )
896
896
self .assertEqual (len (hosts ), len (output ),
897
897
msg = "Host list contains %s identical hosts, only got output for %s" % (
@@ -1347,7 +1347,7 @@ def test_unknown_host_failure(self):
1347
1347
def test_open_channel_failure (self ):
1348
1348
client = ParallelSSHClient ([self .host ], port = self .port ,
1349
1349
pkey = self .user_key )
1350
- output = client .run_command (self .cmd , return_list = True )
1350
+ output = client .run_command (self .cmd )
1351
1351
client .join (output )
1352
1352
output [0 ].client .session .disconnect ()
1353
1353
self .assertRaises (SessionError , output [0 ].client .open_session )
@@ -1411,7 +1411,7 @@ def test_join_timeout_set_no_timeout(self):
1411
1411
def test_read_timeout (self ):
1412
1412
client = ParallelSSHClient ([self .host ], port = self .port ,
1413
1413
pkey = self .user_key )
1414
- output = client .run_command ('sleep .3; echo me; echo me; echo me' , timeout = .2 )
1414
+ output = client .run_command ('sleep .3; echo me; echo me; echo me' , read_timeout = .2 )
1415
1415
for host_out in output :
1416
1416
self .assertRaises (Timeout , list , host_out .stdout )
1417
1417
self .assertFalse (client .finished (output ))
@@ -1425,7 +1425,7 @@ def test_read_timeout(self):
1425
1425
def test_partial_read_timeout_close_cmd (self ):
1426
1426
self .assertTrue (self .client .finished ())
1427
1427
output = self .client .run_command ('while true; do echo a line; sleep .1; done' ,
1428
- use_pty = True , timeout = .15 )
1428
+ use_pty = True , read_timeout = .15 )
1429
1429
stdout = []
1430
1430
try :
1431
1431
with GTimeout (seconds = .25 ):
@@ -1473,8 +1473,6 @@ def test_partial_read_timeout_join_no_output(self):
1473
1473
else :
1474
1474
raise Exception ("Should have timed out" )
1475
1475
self .assertTrue (len (stdout ) > 0 )
1476
- # Should be no-op
1477
- self .client .reset_output_generators (output [0 ], timeout = None )
1478
1476
# Setting timeout
1479
1477
output [0 ].read_timeout = .2
1480
1478
stdout = []
@@ -1522,7 +1520,7 @@ def test_file_read_no_timeout(self):
1522
1520
with open (_file , 'wb' ) as fh :
1523
1521
fh .writelines (contents )
1524
1522
try :
1525
- output = self .client .run_command ('cat %s' % (_file ,), timeout = 10 )
1523
+ output = self .client .run_command ('cat %s' % (_file ,), read_timeout = 10 )
1526
1524
_out = list (output [0 ].stdout )
1527
1525
finally :
1528
1526
os .unlink (_file )
@@ -1830,11 +1828,11 @@ def test_multiple_join_timeout(self):
1830
1828
client = ParallelSSHClient ([self .host ], port = self .port ,
1831
1829
pkey = self .user_key )
1832
1830
for _ in range (5 ):
1833
- output = client .run_command (self .cmd , return_list = True )
1831
+ output = client .run_command (self .cmd )
1834
1832
client .join (output , timeout = 1 , consume_output = True )
1835
1833
for host_out in output :
1836
1834
self .assertTrue (host_out .client .finished (host_out .channel ))
1837
- output = client .run_command ('sleep .2' , return_list = True )
1835
+ output = client .run_command ('sleep .2' )
1838
1836
self .assertRaises (Timeout , client .join , output , timeout = .1 , consume_output = True )
1839
1837
for host_out in output :
1840
1838
self .assertFalse (host_out .client .finished (host_out .channel ))
@@ -1843,12 +1841,12 @@ def test_multiple_run_command_timeout(self):
1843
1841
client = ParallelSSHClient ([self .host ], port = self .port ,
1844
1842
pkey = self .user_key )
1845
1843
for _ in range (5 ):
1846
- output = client .run_command ('pwd' , return_list = True , timeout = 1 )
1844
+ output = client .run_command ('pwd' , read_timeout = 1 )
1847
1845
for host_out in output :
1848
1846
stdout = list (host_out .stdout )
1849
1847
self .assertTrue (len (stdout ) > 0 )
1850
1848
self .assertTrue (host_out .client .finished (host_out .channel ))
1851
- output = client .run_command ('sleep .25; echo me' , return_list = True , timeout = .1 )
1849
+ output = client .run_command ('sleep .25; echo me' , read_timeout = .1 )
1852
1850
for host_out in output :
1853
1851
self .assertRaises (Timeout , list , host_out .stdout )
1854
1852
client .join (output )
@@ -1893,7 +1891,7 @@ def test_read_stdout_no_timeout(self):
1893
1891
cmd = 'sleep .1; echo me; sleep .1; echo me'
1894
1892
read_timeout = 1
1895
1893
output = self .client .run_command (
1896
- cmd , timeout = read_timeout , stop_on_errors = False )
1894
+ cmd , read_timeout = read_timeout , stop_on_errors = False )
1897
1895
for host_out in output :
1898
1896
dt , timed_out = self .read_stream_dt (host_out , host_out .stdout , read_timeout )
1899
1897
self .assertFalse (timed_out )
@@ -1907,7 +1905,7 @@ def test_read_timeout_no_timeouts(self):
1907
1905
read_timeout = 1
1908
1906
# No timeouts
1909
1907
output = self .client .run_command (
1910
- cmd , timeout = read_timeout , stop_on_errors = False , return_list = True )
1908
+ cmd , read_timeout = read_timeout , stop_on_errors = False )
1911
1909
for host_out in output :
1912
1910
dt , timed_out = self .read_stream_dt (host_out , host_out .stdout , read_timeout )
1913
1911
self .assertTrue (dt .total_seconds () < read_timeout )
@@ -1917,11 +1915,11 @@ def test_read_timeout_no_timeouts(self):
1917
1915
self .assertTrue (dt .total_seconds () < read_timeout )
1918
1916
1919
1917
def test_read_stdout_timeout_stderr_no_timeout (self ):
1918
+ """No timeouts for stderr only"""
1920
1919
cmd = 'sleep .1; echo me >&2; sleep .1; echo me >&2; sleep .1'
1921
1920
read_timeout = .25
1922
- # No timeouts for stderr only
1923
1921
output = self .client .run_command (
1924
- cmd , timeout = read_timeout , stop_on_errors = False )
1922
+ cmd , read_timeout = read_timeout , stop_on_errors = False )
1925
1923
for host_out in output :
1926
1924
dt , timed_out = self .read_stream_dt (host_out , host_out .stdout , read_timeout )
1927
1925
self .assertTrue (timed_out )
0 commit comments