From 6e076aac5e7d6722129ab4541b2cbc3c907c4e3c Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Fri, 11 Sep 2020 15:44:38 +0500 Subject: [PATCH] bug fix: remove leftover if backup failed --- plogical/IncScheduler.py | 2 +- plogical/backupSchedule.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/plogical/IncScheduler.py b/plogical/IncScheduler.py index 63e89dde2..ebe73de22 100644 --- a/plogical/IncScheduler.py +++ b/plogical/IncScheduler.py @@ -249,7 +249,7 @@ class IncScheduler(): ## Create CyberPanel Folder file_metadata = { - 'name': 'CyberPanel-%s' % (ipAddress), + 'name': '%s-%s' % (items.name, ipAddress), 'mimeType': 'application/vnd.google-apps.folder' } file = drive.files().create(body=file_metadata, diff --git a/plogical/backupSchedule.py b/plogical/backupSchedule.py index ef6d4f554..60b3d8885 100755 --- a/plogical/backupSchedule.py +++ b/plogical/backupSchedule.py @@ -126,6 +126,9 @@ class backupSchedule: command = 'sudo rm -f ' + pid ProcessUtilities.normalExecutioner(command) + command = 'rm -rf %s' % (tempStoragePath) + ProcessUtilities.normalExecutioner(command) + backupObs = Backups.objects.filter(fileName=fileName) for items in backupObs: items.delete() @@ -187,6 +190,10 @@ class backupSchedule: return 0, 'Backup process killed.' else: if killCounter == 1: + + command = 'rm -rf %s' % (tempStoragePath) + ProcessUtilities.normalExecutioner(command) + return 0, 'Backup process killed without reporting any error. [184]' elif os.path.exists(schedulerPath): backupSchedule.remoteBackupLogging(backupLogPath, 'Backup process killed. Error: %s' % (