Skip to content

Commit 50bf262

Browse files
committed
bug fix in backup creation
1 parent 28955c5 commit 50bf262

File tree

1 file changed

+13
-22
lines changed

1 file changed

+13
-22
lines changed

plogical/backupUtilities.py

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,7 @@ def prepareBackupMeta(backupDomain, backupName, tempStoragePath, backupPath, Fro
222222

223223
metaFileXML.append(aliasesXML)
224224
except BaseException as msg:
225-
#logging.CyberCPLogFileWriter.statusWriter(status, '%s. [167:prepMeta]' % (str(msg)))
226-
command = "echo '%s. [167:prepMeta]' > %s" % (str(msg),status)
227-
ProcessUtilities.executioner(command, website.externalApp)
225+
logging.CyberCPLogFileWriter.writeToFile('%s. [167:prepMeta]' % (str(msg)))
228226

229227
## Finish Alias
230228

@@ -251,9 +249,7 @@ def prepareBackupMeta(backupDomain, backupName, tempStoragePath, backupPath, Fro
251249

252250
metaFileXML.append(dnsRecordsXML)
253251
except BaseException as msg:
254-
#logging.CyberCPLogFileWriter.statusWriter(status, '%s. [158:prepMeta]' % (str(msg)))
255-
command = "echo '%s. [158:prepMeta]' > %s" % (str(msg), status)
256-
ProcessUtilities.executioner(command, website.externalApp)
252+
logging.CyberCPLogFileWriter.writeToFile('%s. [158:prepMeta]' % (str(msg)))
257253

258254
## Email accounts XML
259255

@@ -274,9 +270,7 @@ def prepareBackupMeta(backupDomain, backupName, tempStoragePath, backupPath, Fro
274270

275271
metaFileXML.append(emailRecordsXML)
276272
except BaseException as msg:
277-
#logging.CyberCPLogFileWriter.statusWriter(status, '%s. [179:prepMeta]' % (str(msg)))
278-
command = "echo '%s. [179:prepMeta]' > %s" % (str(msg), status)
279-
ProcessUtilities.executioner(command, website.externalApp)
273+
logging.CyberCPLogFileWriter.writeToFile('%s. [179:prepMeta]' % (str(msg)))
280274

281275
## Email meta generated!
282276

@@ -1964,15 +1958,11 @@ def submitBackupCreation(tempStoragePath, backupName, backupPath, backupDomain):
19641958

19651959
schedulerPath = '/home/cyberpanel/%s-backup.txt' % (backupDomain)
19661960

1967-
command = 'mkdir -p %s' % (backupPath)
1968-
ProcessUtilities.executioner(command, website.externalApp)
1969-
19701961
##
19711962

19721963
command = 'mkdir -p %s' % (tempStoragePath)
19731964
ProcessUtilities.executioner(command, website.externalApp)
19741965

1975-
19761966
##
19771967

19781968
command = 'touch %s' % (status)
@@ -1984,13 +1974,17 @@ def submitBackupCreation(tempStoragePath, backupName, backupPath, backupDomain):
19841974
writeToFile = open(schedulerPath, 'w')
19851975
writeToFile.writelines('1325')
19861976
writeToFile.close()
1987-
logging.CyberCPLogFileWriter.statusWriter(status, str(result[1]) + ' [1084][5009]')
1977+
command = "echo '%s [1084][5009]' > %s" % (str(result[1]), status)
1978+
ProcessUtilities.executioner(command, website.externalApp)
19881979
return 0
19891980

19901981

19911982
command = 'chown %s:%s %s' % (website.externalApp, website.externalApp, result[2])
19921983
ProcessUtilities.executioner(command)
19931984

1985+
logging.CyberCPLogFileWriter.writeToFile(backupPath)
1986+
logging.CyberCPLogFileWriter.writeToFile(tempStoragePath)
1987+
19941988
execPath = "sudo nice -n 10 /usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py"
19951989
execPath = execPath + " startBackup --tempStoragePath " + tempStoragePath + " --backupName " \
19961990
+ backupName + " --backupPath " + backupPath + ' --backupDomain ' + backupDomain + ' --metaPath %s' % (
@@ -2028,15 +2022,12 @@ def submitBackupCreation(tempStoragePath, backupName, backupPath, backupDomain):
20282022

20292023
#output = ProcessUtilities.outputExecutioner(execPath, website.externalApp)
20302024

2031-
if output.find('1,None') > -1:
2032-
execPath = "sudo nice -n 10 /usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py"
2033-
execPath = execPath + " BackupRoot --tempStoragePath " + tempStoragePath + " --backupName " \
2034-
+ backupName + " --backupPath " + backupPath + ' --backupDomain ' + backupDomain + ' --metaPath %s' % (
2035-
result[2])
2025+
execPath = "sudo nice -n 10 /usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py"
2026+
execPath = execPath + " BackupRoot --tempStoragePath " + tempStoragePath + " --backupName " \
2027+
+ backupName + " --backupPath " + backupPath + ' --backupDomain ' + backupDomain + ' --metaPath %s' % (
2028+
result[2])
20362029

2037-
ProcessUtilities.executioner(execPath, 'root')
2038-
else:
2039-
logging.CyberCPLogFileWriter.writeToFile(output)
2030+
ProcessUtilities.executioner(execPath, 'root')
20402031

20412032
command = 'chown -R %s:%s %s' % (website.externalApp, website.externalApp, backupPath)
20422033
ProcessUtilities.executioner(command)

0 commit comments

Comments
 (0)