Fix SSHClient connect call

Add Port setting to ini
This commit is contained in:
Kumi 2021-11-26 07:39:21 +01:00
parent 1e6d6b38dc
commit 5318285556
2 changed files with 7 additions and 2 deletions

View file

@ -24,7 +24,7 @@ class Connection:
self._client = SSHClient()
self._client.load_system_host_keys()
self._client.set_missing_host_key_policy(WarningPolicy)
self._client.connect(vessel.address, vessel.username,
self._client.connect(vessel.address, vessel.port, vessel.username,
vessel.password, passphrase=vessel.passphrase)
self._transport = self._client.get_transport()
self._transport.set_keepalive(10)

View file

@ -33,6 +33,7 @@ class Vessel:
username = None
password = None
passphrase = None
port = 22
if "TempDir" in config.keys():
tempdir = config["TempDir"]
@ -46,6 +47,9 @@ class Vessel:
if "Passphrase" in config.keys():
passphrase = config["Passphrase"]
if "Port" in config.keys():
port = config["Port"]
if "Address" in config.keys():
return cls(config.name.split()[1], config["Address"], username,
password, passphrase, tempdir)
@ -55,7 +59,7 @@ class Vessel:
def __init__(self, name: str, address: str, username: Optional[str] = None,
password: Optional[str] = None, passphrase: Optional[str] = None,
tempdir: Optional[Union[str, pathlib.Path]] = None) -> None:
port: Optional[int] = None, tempdir: Optional[Union[str, pathlib.Path]] = None) -> None:
"""Initialize new Vessel object
Args:
@ -70,6 +74,7 @@ class Vessel:
self.username = username
self.password = password
self.passphrase = passphrase
self.port = port or 22
self._connection = None
self._uploaded = self.getUploadedFromDB() # Files already uploaded