Skip to content

Commit 6e076aa

Browse files
committed
bug fix: remove leftover if backup failed
1 parent 2ce35a3 commit 6e076aa

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

plogical/IncScheduler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ def runGoogleDriveBackups(type):
249249
## Create CyberPanel Folder
250250

251251
file_metadata = {
252-
'name': 'CyberPanel-%s' % (ipAddress),
252+
'name': '%s-%s' % (items.name, ipAddress),
253253
'mimeType': 'application/vnd.google-apps.folder'
254254
}
255255
file = drive.files().create(body=file_metadata,

plogical/backupSchedule.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ def createLocalBackup(virtualHost, backupLogPath):
126126
command = 'sudo rm -f ' + pid
127127
ProcessUtilities.normalExecutioner(command)
128128

129+
command = 'rm -rf %s' % (tempStoragePath)
130+
ProcessUtilities.normalExecutioner(command)
131+
129132
backupObs = Backups.objects.filter(fileName=fileName)
130133
for items in backupObs:
131134
items.delete()
@@ -187,6 +190,10 @@ def createLocalBackup(virtualHost, backupLogPath):
187190
return 0, 'Backup process killed.'
188191
else:
189192
if killCounter == 1:
193+
194+
command = 'rm -rf %s' % (tempStoragePath)
195+
ProcessUtilities.normalExecutioner(command)
196+
190197
return 0, 'Backup process killed without reporting any error. [184]'
191198
elif os.path.exists(schedulerPath):
192199
backupSchedule.remoteBackupLogging(backupLogPath, 'Backup process killed. Error: %s' % (

0 commit comments

Comments
 (0)