Pavel Loginov 2020-10-25 14:57:17 +06:00
parent 4600980368
commit aefed2d987
3 changed files with 18 additions and 8 deletions

View File

@ -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

View File

@ -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/'):

View File

@ -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