From afabe2dfa816341e27e69d232762032ecfc391ab Mon Sep 17 00:00:00 2001 From: "usman@cyberpersons.com" Date: Sun, 2 Apr 2023 13:49:39 +0500 Subject: [PATCH] bug fix: inc backups --- IncBackups/views.py | 2 +- plogical/Backupsv2.py | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/IncBackups/views.py b/IncBackups/views.py index b723a86d1..62c054566 100644 --- a/IncBackups/views.py +++ b/IncBackups/views.py @@ -775,7 +775,6 @@ def createV2BackupSetup(request): return redirect(loadLoginPage) def CreateV2BackupButton(request): - import re try: userID = request.session['userID'] data = json.loads(request.body) @@ -795,6 +794,7 @@ def CreateV2BackupButton(request): extra_args = {} extra_args['function'] = 'InitiateBackup' extra_args['website'] = Selectedwebsite + extra_args['domain'] = Selectedwebsite extra_args['BasePath'] = '/home/backup' extra_args['BackendName'] = Selectedrepo extra_args['BackupData'] = data['websiteData'] if 'websiteData' in data else False diff --git a/plogical/Backupsv2.py b/plogical/Backupsv2.py index 40a394d7e..0a2341a94 100644 --- a/plogical/Backupsv2.py +++ b/plogical/Backupsv2.py @@ -143,7 +143,6 @@ token = {token} command = f"chmod 600 {self.ConfigFilePath}" ProcessUtilities.executioner(command, self.website.externalApp) - @staticmethod def FetchCurrentTimeStamp(): import time @@ -217,12 +216,18 @@ token = {token} snapshots= f'{snapshots} {snapshot}' - command = f'rustic -r {self.repo} merge {snapshots} --password "" --json 2>/dev/null' - result = json.loads(ProcessUtilities.outputExecutioner(command, self.website.externalApp, True).rstrip('\n')) + command = f'rustic -r {self.repo} merge {snapshots} --password "" --json' + result = ProcessUtilities.outputExecutioner(command, self.website.externalApp, True) + + if os.path.exists(ProcessUtilities.debugPath): + logging.CyberCPLogFileWriter.writeToFile(result) command = f'rustic -r {self.repo} forget {snapshots} --password ""' result = ProcessUtilities.outputExecutioner(command, self.website.externalApp, True) + if os.path.exists(ProcessUtilities.debugPath): + logging.CyberCPLogFileWriter.writeToFile(result) + def InitiateBackup(self): from websiteFunctions.models import Websites, Backupsv2