Explicitly close paramiko connection

This commit is contained in:
daniele 2023-06-03 15:56:24 +02:00
parent b34627fe58
commit 809545b172
Signed by: fuxino
GPG Key ID: 981A2B2A3BBF5514

View File

@ -174,7 +174,7 @@ class Backup:
self._remote = True
if self._remote:
self._ssh = self._ssh_connection()
self._ssh = self._ssh_connect()
if self._ssh is None:
sys.exit(1)
@ -264,6 +264,8 @@ class Backup:
elif count > 1:
logger.info('Removed %d backups', count)
self._ssh.close()
def find_last_backup(self):
"""Get path of last backup (from last_backup symlink) for rsync --link-dest"""
@ -292,7 +294,7 @@ class Backup:
except IndexError:
logger.info('No previous backups available')
def _ssh_connection(self):
def _ssh_connect(self):
ssh = paramiko.SSHClient()
ssh.load_system_host_keys()
ssh.set_missing_host_key_policy(paramiko.WarningPolicy())