From aefed2d987977129a8799b5ddf954c5eb5b13eaa Mon Sep 17 00:00:00 2001 From: Pavel Loginov Date: Sun, 25 Oct 2020 14:57:17 +0600 Subject: [PATCH] v4.5.2.0 Changelog: https://haproxy-wi.org/changelog.py#4_5_2 --- app/funct.py | 2 +- app/options.py | 8 +++++++- app/sql.py | 16 ++++++++++------ 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/app/funct.py b/app/funct.py index 154cbe45..cd1847a4 100644 --- a/app/funct.py +++ b/app/funct.py @@ -251,7 +251,7 @@ def ssh_connect(serv, **kwargs): ssh.connect(hostname=serv, port=ssh_port, username=ssh_user_name, password=ssh_user_password, timeout=11) return ssh except paramiko.AuthenticationException: - return 'error: Authentication failed, please verify your credentials' + return 'Authentication failed, please verify your credentials' pass except paramiko.SSHException as sshException: return 'error: Unable to establish SSH connection: %s ' % sshException diff --git a/app/options.py b/app/options.py index ac7315ff..d784471f 100644 --- a/app/options.py +++ b/app/options.py @@ -1846,7 +1846,13 @@ if form.getvalue('ssh_cert'): key = paramiko.pkey.load_private_key(form.getvalue('ssh_cert')) ssh_keys = os.path.dirname(os.getcwd()) + '/keys/' + name + '.pem' - if not os.path.isfile(ssh_keys): + try: + split_name = name.split('_')[1] + split_name = True + except Exception: + split_name = False + + if not os.path.isfile(ssh_keys) and not split_name: name = name + '_' + user_group if not os.path.exists(os.getcwd() + '/keys/'): diff --git a/app/sql.py b/app/sql.py index 1d7dbc26..b70102d2 100644 --- a/app/sql.py +++ b/app/sql.py @@ -1772,13 +1772,15 @@ def update_setting(param, val): try: cur.execute(sql) con.commit() + cur.close() + con.close() return True except sqltool.Error as e: funct.out_error(e) con.rollback() + cur.close() + con.close() return False - cur.close() - con.close() def get_ver(): @@ -2257,10 +2259,12 @@ def is_cloud(): con.close() return "" else: - cur.close() - con.close() - for cloud_uuid in cur.fetchall(): - return cloud_uuid[0] + for cl_uuid in cur.fetchall(): + cloud_uuid = cl_uuid[0] + + cur.close() + con.close() + return cloud_uuid form = funct.form