Prevent exception in Connection object if connection fails

This commit is contained in:
Kumi 2022-08-08 10:12:19 +00:00
parent 011d35aa22
commit 7257ba1985
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -20,6 +20,7 @@ class Connection:
vessel (classes.vessel.Vessel): Vessel object to open connection to
"""
self._vessel = vessel
self._process = None
self._client = SSHClient()
self._client.load_system_host_keys()
self._client.set_missing_host_key_policy(WarningPolicy)
@ -29,7 +30,6 @@ class Connection:
self._transport = self._client.get_transport()
self._transport.set_keepalive(10)
self._sftp = self._client.open_sftp()
self._process = None
def forward_tcp(self, remote=3306):
self._process = SSHTunnelForwarder(