Skip to content

Commit

Permalink
bug fix: remove leftover if backup failed
Browse files Browse the repository at this point in the history
  • Loading branch information
usmannasir committed Sep 11, 2020
1 parent 2ce35a3 commit 6e076aa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion plogical/IncScheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def runGoogleDriveBackups(type):
## 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,
Expand Down
7 changes: 7 additions & 0 deletions plogical/backupSchedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ def createLocalBackup(virtualHost, backupLogPath):
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()
Expand Down Expand Up @@ -187,6 +190,10 @@ def createLocalBackup(virtualHost, backupLogPath):
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' % (
Expand Down

0 comments on commit 6e076aa

Please sign in to comment.