bug fix: incremental backups

This commit is contained in:
Usman Nasir
2019-12-21 19:34:11 +05:00
parent d31ddad964
commit 44c2d9b690
4 changed files with 12 additions and 16 deletions

View File

@@ -137,7 +137,7 @@ class IncJobs(multi.Thread):
snapShotid = result.split(' ')[-2]
if bType == 'database':
newSnapshot = JobSnapshots(job=self.jobid,
type='%s:%s' % (bType, backupPath.split('/')[-1].strip('.sql')),
type='%s:%s' % (bType, backupPath.split('/')[-1].rstrip('.sql')),
snapshotid=snapShotid,
destination=self.backupDestinations)
else:
@@ -177,7 +177,7 @@ class IncJobs(multi.Thread):
if type == 'database':
newSnapshot = JobSnapshots(job=self.jobid,
type='%s:%s' % (type, backupPath.split('/')[-1].strip('.sql')),
type='%s:%s' % (type, backupPath.split('/')[-1].rstrip('.sql')),
snapshotid=snapShotid,
destination=self.backupDestinations)
else:
@@ -202,7 +202,7 @@ class IncJobs(multi.Thread):
if type == 'database':
newSnapshot = JobSnapshots(job=self.jobid,
type='%s:%s' % (type, backupPath.split('/')[-1].strip('.sql')),
type='%s:%s' % (type, backupPath.split('/')[-1].rstrip('.sql')),
snapshotid=snapShotid,
destination=self.backupDestinations)
else:
@@ -267,7 +267,7 @@ class IncJobs(multi.Thread):
if mysqlUtilities.mysqlUtilities.restoreDatabaseBackup(self.jobid.type.split(':')[1].rstrip('.sql'),
'/home/cyberpanel', 'dummy', 'dummy') == 0:
raise BaseException
raise BaseException('Can not restore database backup.')
try:
if self.reconstruct == 'remote':
@@ -318,7 +318,7 @@ class IncJobs(multi.Thread):
self.awsFunction('restore', '', self.jobid.snapshotid)
metaPathNew = '/home/%s/meta.xml' % (self.website)
execPath = "nice -n 10 /usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/IncBackups/restoreMeta.py"
execPath = "nice -n 10 /usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/restoreMeta.py"
execPath = execPath + " submitRestore --metaPath %s --statusFile %s" % (metaPathNew, self.statusPath)
result = ProcessUtilities.outputExecutioner(execPath)
logging.statusWriter(self.statusPath, result, 1)
@@ -559,7 +559,7 @@ class IncJobs(multi.Thread):
xmlpretty = prettify(metaFileXML).encode('ascii', 'ignore')
metaFile = open(metaPath, 'w')
metaFile.write(xmlpretty)
metaFile.write(xmlpretty.decode('utf-8'))
metaFile.close()
os.chmod(metaPath, 0o640)

View File

@@ -1,4 +1,4 @@
#!/usr/local/CyberCP/bin/python2
#!/usr/local/CyberCP/bin/python
import os.path
import sys
sys.path.append('/usr/local/CyberCP')
@@ -79,7 +79,7 @@ class IncScheduler():
logging.statusWriter(IncScheduler.logPath, 'Failed backup for %s, error: %s.' % (web.website, result), 1)
break
except BaseException, msg:
except BaseException as msg:
logging.writeToFile(str(msg))

View File

@@ -1,15 +1,11 @@
#!/usr/local/CyberCP/bin/python
import os
import os.path
import sys
sys.path.append('/usr/local/CyberCP')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
import django
try:
django.setup()
except:
pass
django.setup()
from websiteFunctions.models import Websites
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
from xml.etree import ElementTree

View File

@@ -758,7 +758,7 @@ class WebsiteManager:
diff = finalDate - now
Data['viewSSL'] = 1
Data['days'] = str(diff.days)
Data['authority'] = x509.get_issuer().get_components()[1][1]
Data['authority'] = x509.get_issuer().get_components()[1][1].decode('utf-8')
if Data['authority'] == 'Denial':
Data['authority'] = '%s has SELF-SIGNED SSL.' % (self.domain)
@@ -866,7 +866,7 @@ class WebsiteManager:
diff = finalDate - now
Data['viewSSL'] = 1
Data['days'] = str(diff.days)
Data['authority'] = x509.get_issuer().get_components()[1][1]
Data['authority'] = x509.get_issuer().get_components()[1][1].decode('utf-8')
if Data['authority'] == 'Denial':
Data['authority'] = '%s has SELF-SIGNED SSL.' % (self.childDomain)