diff --git a/IncBackups/IncBackupsControl.py b/IncBackups/IncBackupsControl.py index 071f940a6..89fbceb29 100644 --- a/IncBackups/IncBackupsControl.py +++ b/IncBackups/IncBackupsControl.py @@ -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) diff --git a/plogical/IncScheduler.py b/plogical/IncScheduler.py index 6e874bf7c..eeeffb886 100644 --- a/plogical/IncScheduler.py +++ b/plogical/IncScheduler.py @@ -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)) diff --git a/IncBackups/restoreMeta.py b/plogical/restoreMeta.py similarity index 99% rename from IncBackups/restoreMeta.py rename to plogical/restoreMeta.py index c89e3f2f1..8a267d38a 100644 --- a/IncBackups/restoreMeta.py +++ b/plogical/restoreMeta.py @@ -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 diff --git a/websiteFunctions/website.py b/websiteFunctions/website.py index 3a0dbcb69..fe6f08cc9 100755 --- a/websiteFunctions/website.py +++ b/websiteFunctions/website.py @@ -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)