bug fix: backup creation

This commit is contained in:
Usman Nasir
2021-11-16 19:12:34 +05:00
parent c563325796
commit 8d3eac6b29
5 changed files with 22 additions and 19 deletions

View File

@@ -340,8 +340,7 @@ def get_backup_status(request):
else:
return ACLManager.loadErrorJson('fetchStatus', 0)
if (status[:16] == "/home/cyberpanel" or status[:4] == '/tmp' or status[:18] == '/usr/local/CyberCP') \
and status != '/usr/local/CyberCP/CyberCP/settings.py' and status.find('..') == -1:
if ACLManager.CheckStatusFilleLoc(status):
pass
else:
data_ret = {'abort': 1, 'installStatus': 0, 'installationProgress': "100",

View File

@@ -809,4 +809,15 @@ class ACLManager:
return 1
@staticmethod
def CheckStatusFilleLoc(statusFile):
if (statusFile[:18] != "/home/cyberpanel/." or statusFile[:16] == "/home/cyberpanel" or statusFile[
:4] == '/tmp' or statusFile[
:18] == '/usr/local/CyberCP') \
and statusFile != '/usr/local/CyberCP/CyberCP/settings.py' and statusFile.find(
'..') == -1 and statusFile != '/home/cyberpanel/.my.cnf' and statusFile != '/home/cyberpanel/.bashrc' and statusFile != '/home/cyberpanel/.bash_logout' and statusFile != '/home/cyberpanel/.profile':
return 1
else:
return 0

View File

@@ -284,18 +284,16 @@ class backupUtilities:
## /home/example.com/backup/backup-example.com-02.13.2018_10-24-52/meta.xml -- metaPath
metaPath = '%s/%s' % (tempStoragePath, str(randint(1000, 9999)))
metaPath = '/tmp/%s' % (str(randint(1000, 9999)))
if os.path.exists(ProcessUtilities.debugPath):
logging.CyberCPLogFileWriter.writeToFile(f'Path to meta file {metaPath}')
xmlpretty = prettify(metaFileXML).encode('ascii', 'ignore')
# metaFile = open(metaPath, 'w')
# metaFile.write(xmlpretty.decode())
# metaFile.close()
#os.chmod(metaPath, 0o600)
MetaContent = xmlpretty.decode()
metaFile = open(metaPath, 'w')
metaFile.write(xmlpretty.decode())
metaFile.close()
os.chmod(metaPath, 0o600)
## meta generated
@@ -1999,11 +1997,11 @@ def submitBackupCreation(tempStoragePath, backupName, backupPath, backupDomain):
return 0
# command = 'chown %s:%s %s' % (website.externalApp, website.externalApp, result[2])
# ProcessUtilities.executioner(command)
command = 'chown %s:%s %s' % (website.externalApp, website.externalApp, result[2])
ProcessUtilities.executioner(command)
#logging.CyberCPLogFileWriter.writeToFile(backupPath)
#logging.CyberCPLogFileWriter.writeToFile(tempStoragePath)
logging.CyberCPLogFileWriter.writeToFile(backupPath)
logging.CyberCPLogFileWriter.writeToFile(tempStoragePath)
execPath = "sudo nice -n 10 /usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py"
execPath = execPath + " startBackup --tempStoragePath " + tempStoragePath + " --backupName " \

View File

@@ -273,8 +273,6 @@ class virtualHostUtilities:
logging.CyberCPLogFileWriter.statusWriter(tempStatusPath, 'Website successfully created. [200]')
logging.CyberCPLogFileWriter.writeToFile ("hello world [createVirtualHost]")
return 1, 'None'
except BaseException as msg:

View File

@@ -1854,10 +1854,7 @@ class WebsiteManager:
try:
statusFile = data['statusFile']
if (statusFile[:18] != "/home/cyberpanel/." or statusFile[:16] == "/home/cyberpanel" or statusFile[:4] == '/tmp' or statusFile[
:18] == '/usr/local/CyberCP') \
and statusFile != '/usr/local/CyberCP/CyberCP/settings.py' and statusFile.find(
'..') == -1 and statusFile != '/home/cyberpanel/.my.cnf' and statusFile != '/home/cyberpanel/.bashrc' and statusFile != '/home/cyberpanel/.bash_logout' and statusFile != '/home/cyberpanel/.profile':
if ACLManager.CheckStatusFilleLoc(statusFile):
pass
else:
data_ret = {'abort': 1, 'installStatus': 0, 'installationProgress': "100",