bug fix: if scp fail download via sftp

This commit is contained in:
usmannasir
2024-10-10 10:24:03 +05:00
parent b63d30af65
commit 94a6c34074

View File

@@ -6651,7 +6651,18 @@ class ApplicationInstaller(multi.Thread):
statusFile.close()
return 0
else:
logging.writeToFile(f"Success in scp command to retrieve backup {successRet}")
try:
logging.writeToFile(f"Success in scp command to retrieve backup {successRet}")
sftp.get(f'cpbackups/{folder}/{backupfile}', f'/home/cyberpanel/{backupfile}',
callback=self.UpdateDownloadStatus)
except BaseException as msg:
logging.writeToFile(f"Failed to download file {str(msg)} [404]")
statusFile = open(tempStatusPath, 'w')
statusFile.writelines(f"Failed to download file {str(msg)} [404]")
statusFile.close()
return 0
if sftp:
sftp.close() # Close the SFTP session