@@ -98,7 +98,8 @@ def open(self):
9898 timeout = self ._timeout ,
9999 pkey = self .pkey ,
100100 port = self ._executor .port ,
101- disabled_algorithms = self ._executor .disabled_algorithms
101+ disabled_algorithms = self ._executor .disabled_algorithms ,
102+ sock = self ._executor .sock ,
102103 )
103104 except (socket .gaierror , socket .herror ) as ex :
104105 args = list (ex .args )
@@ -222,21 +223,25 @@ def __init__(self,
222223 use_pkey = False ,
223224 port = 22 ,
224225 sudo = False ,
225- disabled_algorithms = None ):
226+ disabled_algorithms = None ,
227+ sock = None ,
228+ ):
226229 """
227230 Args:
228231 use_pkey (bool): Use ssh private key in the connection
229232 user (instance of User): User
230233 address (str): Ip / hostname
231234 port (int): Port to connect
232235 sudo (bool): Use sudo to execute command.
236+ sock (ProxyCommand): Proxy command to use.
233237 """
234238 super (RemoteExecutor , self ).__init__ (user )
235239 self .address = address
236240 self .use_pkey = use_pkey
237241 self .port = port
238242 self .sudo = sudo
239243 self .disabled_algorithms = disabled_algorithms
244+ self .sock = sock
240245 if use_pkey :
241246 warnings .warn (
242247 "Parameter 'use_pkey' is deprecated and will be removed in "
@@ -335,10 +340,13 @@ def wait_for_connectivity_state(
335340
336341
337342class RemoteExecutorFactory (ExecutorFactory ):
338- def __init__ (self , use_pkey = False , port = 22 , disabled_algorithms = None ):
343+ def __init__ (
344+ self , use_pkey = False , port = 22 , disabled_algorithms = None , sock = None
345+ ):
339346 self .use_pkey = use_pkey
340347 self .port = port
341348 self .disabled_algorithms = disabled_algorithms
349+ self .sock = sock
342350 if use_pkey :
343351 warnings .warn (
344352 "Parameter 'use_pkey' is deprecated and will be removed in "
@@ -352,4 +360,6 @@ def build(self, host, user, sudo=False):
352360 use_pkey = self .use_pkey ,
353361 port = self .port ,
354362 sudo = sudo ,
355- disabled_algorithms = self .disabled_algorithms )
363+ disabled_algorithms = self .disabled_algorithms ,
364+ sock = paramiko .ProxyCommand (self .sock ) if self .sock else self .sock ,
365+ )
0 commit comments