Handle getpass exception

This commit is contained in:
daniele 2023-07-16 08:22:51 +02:00
parent e3a970217f
commit 77661c0964
Signed by: fuxino
GPG Key ID: 981A2B2A3BBF5514

View File

@ -26,7 +26,7 @@ from timeit import default_timer
from subprocess import Popen, PIPE, STDOUT from subprocess import Popen, PIPE, STDOUT
from datetime import datetime from datetime import datetime
from tempfile import mkstemp from tempfile import mkstemp
from getpass import getpass from getpass import GetPassWarning, getpass
from glob import glob from glob import glob
from dotenv import load_dotenv from dotenv import load_dotenv
@ -355,6 +355,11 @@ class Backup:
os.environ['SSHPASS'] = password os.environ['SSHPASS'] = password
return ssh return ssh
except GetPassWarning as e:
logger.critical('Unable to get password')
logger.critical(e)
return None
except paramiko.SSHException as e: except paramiko.SSHException as e:
logger.critical('Can\'t connect to the server.') logger.critical('Can\'t connect to the server.')
logger.critical(e) logger.critical(e)