From 94a6c34074536da8a8fc7aaa76571e2bb260a7f5 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Thu, 10 Oct 2024 10:24:03 +0500 Subject: [PATCH] bug fix: if scp fail download via sftp --- plogical/applicationInstaller.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/plogical/applicationInstaller.py b/plogical/applicationInstaller.py index 934e4696f..48bf2e721 100755 --- a/plogical/applicationInstaller.py +++ b/plogical/applicationInstaller.py @@ -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