mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-14 17:26:17 +01:00
bug fix: fetch packages
This commit is contained in:
@@ -686,7 +686,7 @@ def fetchPackages(request):
|
|||||||
return ACLManager.loadError()
|
return ACLManager.loadError()
|
||||||
|
|
||||||
data = json.loads(request.body)
|
data = json.loads(request.body)
|
||||||
page = int(data['page'])
|
page = int(data['page'].rstrip('\n'))
|
||||||
recordsToShow = int(data['recordsToShow'])
|
recordsToShow = int(data['recordsToShow'])
|
||||||
|
|
||||||
packageInformation = '/home/cyberpanel/OSPackages'
|
packageInformation = '/home/cyberpanel/OSPackages'
|
||||||
@@ -698,23 +698,24 @@ def fetchPackages(request):
|
|||||||
|
|
||||||
packages = ProcessUtilities.outputExecutioner('cat %s' % (packageInformation)).split('\n')
|
packages = ProcessUtilities.outputExecutioner('cat %s' % (packageInformation)).split('\n')
|
||||||
|
|
||||||
if os.path.exists(ProcessUtilities.debugPath):
|
# if os.path.exists(ProcessUtilities.debugPath):
|
||||||
logging.CyberCPLogFileWriter.writeToFile('All packages: %s' % (str(packages)))
|
# logging.CyberCPLogFileWriter.writeToFile('All packages: %s' % (str(packages)))
|
||||||
|
|
||||||
from s3Backups.s3Backups import S3Backups
|
from s3Backups.s3Backups import S3Backups
|
||||||
|
|
||||||
pagination = S3Backups.getPagination(len(packages), recordsToShow)
|
pagination = S3Backups.getPagination(len(packages), recordsToShow)
|
||||||
|
logging.CyberCPLogFileWriter.writeToFile(str(pagination))
|
||||||
endPageNumber, finalPageNumber = S3Backups.recordsPointer(page, recordsToShow)
|
endPageNumber, finalPageNumber = S3Backups.recordsPointer(page, recordsToShow)
|
||||||
finalPackages = packages[finalPageNumber:endPageNumber]
|
finalPackages = packages[finalPageNumber:endPageNumber]
|
||||||
|
|
||||||
json_data = "["
|
json_data = "["
|
||||||
checker = 0
|
checker = 0
|
||||||
|
|
||||||
if os.path.exists(ProcessUtilities.debugPath):
|
# if os.path.exists(ProcessUtilities.debugPath):
|
||||||
logging.CyberCPLogFileWriter.writeToFile('Final packages: %s' % (str(finalPackages)))
|
# logging.CyberCPLogFileWriter.writeToFile('Final packages: %s' % (str(finalPackages)))
|
||||||
|
import re
|
||||||
for items in finalPackages:
|
for items in finalPackages:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(items)
|
items = re.sub(r'("[\s\w]*)"([\s\w])*"([\s\w]*)',r"\1\2\3", items)
|
||||||
try:
|
try:
|
||||||
if checker == 0:
|
if checker == 0:
|
||||||
json_data = json_data + items
|
json_data = json_data + items
|
||||||
|
|||||||
Reference in New Issue
Block a user