File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change 1+ """Ports and sockets forwarding tunnel over SSH with systems SSH client."""
12import logging
23import os
34import subprocess
1011
1112
1213class SSHTunnelConnectionError (Exception ):
13- pass
14+ """Connection error exception."""
1415
1516
1617@contextmanager
1718def create_ssh_tunnel (
1819 hostname : str , local_socket : str , remote_socket : str , timeout : int = 10
1920) -> Generator [str , None , None ]:
21+ """Create SSH tunnel."""
2022 ssh_socket_filename = gen_temp_socket_filename (f"{ hostname } ." )
2123 ssh_tunnel_cmd = [
2224 "ssh" ,
@@ -80,6 +82,7 @@ def create_ssh_tunnel(
8082def gen_temp_socket_filename (
8183 prefix : Optional [str ] = None , suffix : Optional [str ] = None
8284) -> str :
85+ """Get filename for temporary socket file."""
8386 temp_socket_filename = None
8487 with tempfile .NamedTemporaryFile (
8588 suffix = suffix , prefix = prefix , dir = tempfile .gettempdir ()
You can’t perform that action at this time.
0 commit comments