mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-01-17 13:02:07 +01:00
p3
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.contrib import admin
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import models
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ class ServerStatusUtil:
|
||||
return 0
|
||||
else:
|
||||
return 1
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
return 0
|
||||
|
||||
@@ -124,7 +124,7 @@ class ServerStatusUtil:
|
||||
|
||||
|
||||
return 1
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
return 0
|
||||
|
||||
@@ -147,7 +147,7 @@ class ServerStatusUtil:
|
||||
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,"Filemanager files are set!\n")
|
||||
|
||||
return 1
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
return 0
|
||||
|
||||
@@ -196,7 +196,7 @@ class ServerStatusUtil:
|
||||
cmd = shlex.split(command)
|
||||
subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
return 0
|
||||
|
||||
@@ -233,7 +233,7 @@ class ServerStatusUtil:
|
||||
cmd = shlex.split(command)
|
||||
subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
return 0
|
||||
|
||||
@@ -254,7 +254,7 @@ class ServerStatusUtil:
|
||||
if ServerStatusUtil.createDomain(child) == 0:
|
||||
logging.CyberCPLogFileWriter.writeToFile(
|
||||
'Error while creating child domain: ' + child.domain)
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(
|
||||
'Error while creating child domain: ' + child.domain + ' . Exact message: ' + str(
|
||||
msg))
|
||||
@@ -266,14 +266,14 @@ class ServerStatusUtil:
|
||||
aliasDomain = alias.aliasDomain
|
||||
alias.delete()
|
||||
virtualHostUtilities.createAlias(website.domain, aliasDomain, 0, '/home', website.adminEmail, website.admin)
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(
|
||||
'Error while creating alais domain: ' + aliasDomain + ' . Exact message: ' + str(
|
||||
msg))
|
||||
|
||||
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
|
||||
"vhost conf successfully built for: " + website.domain + ".\n", 1)
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
return 0
|
||||
|
||||
@@ -351,7 +351,7 @@ class ServerStatusUtil:
|
||||
|
||||
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,"Successfully switched to LITESPEED ENTERPRISE WEB SERVER. [200]\n", 1)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
|
||||
"%s. [404]" % (str(msg)), 1)
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.test import TestCase
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.shortcuts import render, redirect
|
||||
from django.http import HttpResponse
|
||||
@@ -75,7 +75,7 @@ def litespeedStatus(request):
|
||||
else:
|
||||
loadedModules.append(items)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[litespeedStatus]")
|
||||
return render(request, "serverStatus/litespeedStatus.html", {"processList": processList,
|
||||
"liteSpeedVersionStatus": "For some reaons not able to load version details, see CyberCP main log file.",
|
||||
@@ -89,7 +89,7 @@ def litespeedStatus(request):
|
||||
"loadedModules": loadedModules, 'OLS': OLS, 'message': message}
|
||||
return render(request, "serverStatus/litespeedStatus.html", dataForHtml)
|
||||
|
||||
except KeyError, msg:
|
||||
except KeyError as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[litespeedStatus]")
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
@@ -123,7 +123,7 @@ def stopOrRestartLitespeed(request):
|
||||
final_json = json.dumps(status)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except KeyError, msg:
|
||||
except KeyError as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[stopOrRestartLitespeed]")
|
||||
return HttpResponse("Not Logged in as admin")
|
||||
|
||||
@@ -141,7 +141,7 @@ def cyberCPMainLogFile(request):
|
||||
|
||||
return render(request, 'serverStatus/cybercpmainlogfile.html')
|
||||
|
||||
except KeyError, msg:
|
||||
except KeyError as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[cyberCPMainLogFile]")
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
@@ -163,7 +163,7 @@ def getFurtherDataFromLogFile(request):
|
||||
final_json = json.dumps(status)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except KeyError, msg:
|
||||
except KeyError as msg:
|
||||
status = {"logstatus": 0,
|
||||
"error": "Could not fetch data from log file, please see CyberCP main log file through command line."}
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[getFurtherDataFromLogFile]")
|
||||
@@ -335,11 +335,11 @@ def servicesAction(request):
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'serviceAction': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
except KeyError, msg:
|
||||
except KeyError as msg:
|
||||
final_dic = {'serviceAction': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -373,7 +373,7 @@ def switchTOLSWS(request):
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data_ret = {'status': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
@@ -402,7 +402,7 @@ def switchTOLSWSStatus(request):
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
command = "sudo rm -f " + serverStatusUtil.ServerStatusUtil.lswsInstallStatusPath
|
||||
ProcessUtilities.popenExecutioner(command)
|
||||
data_ret = {'status': 0,'abort': 1, 'requestStatus': str(msg), 'installed': 0}
|
||||
@@ -431,11 +431,11 @@ def licenseStatus(request):
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'status': 0, 'erroMessage': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
except KeyError, msg:
|
||||
except KeyError as msg:
|
||||
final_dic = {'status': 0, 'erroMessage': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -477,11 +477,11 @@ def changeLicense(request):
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'status': 0, 'erroMessage': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
except KeyError, msg:
|
||||
except KeyError as msg:
|
||||
final_dic = {'status': 0, 'erroMessage': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -501,7 +501,7 @@ def topProcesses(request):
|
||||
proc = httpProc(request, templateName)
|
||||
return proc.renderPre()
|
||||
|
||||
except KeyError, msg:
|
||||
except KeyError as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[litespeedStatus]")
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
@@ -526,19 +526,19 @@ def topProcessesStatus(request):
|
||||
counter = 0
|
||||
|
||||
loadAVG = data[0].split(' ')
|
||||
loadAVG = filter(lambda a: a != '', loadAVG)
|
||||
loadAVG = [a for a in loadAVG if a != '']
|
||||
|
||||
loadNow = data[2].split(' ')
|
||||
loadNow = filter(lambda a: a != '', loadNow)
|
||||
loadNow = [a for a in loadNow if a != '']
|
||||
|
||||
memory = data[3].split(' ')
|
||||
memory = filter(lambda a: a != '', memory)
|
||||
memory = [a for a in memory if a != '']
|
||||
|
||||
swap = data[4].split(' ')
|
||||
swap = filter(lambda a: a != '', swap)
|
||||
swap = [a for a in swap if a != '']
|
||||
|
||||
processes = data[1].split(' ')
|
||||
processes = filter(lambda a: a != '', processes)
|
||||
processes = [a for a in processes if a != '']
|
||||
|
||||
for items in data:
|
||||
counter = counter + 1
|
||||
@@ -546,7 +546,7 @@ def topProcessesStatus(request):
|
||||
continue
|
||||
|
||||
points = items.split(' ')
|
||||
points = filter(lambda a: a != '', points)
|
||||
points = [a for a in points if a != '']
|
||||
|
||||
dic = {'PID': points[0], 'User': points[1], 'VIRT': points[4],
|
||||
'RES': points[5], 'S': points[7], 'CPU': points[8], 'MEM': points[9],
|
||||
@@ -623,7 +623,7 @@ def topProcessesStatus(request):
|
||||
final_json = json.dumps(data)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data_ret = {'status': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
@@ -649,11 +649,11 @@ def killProcess(request):
|
||||
proc = httpProc(request, None)
|
||||
return proc.ajax(1, None)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'status': 0, 'erroMessage': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
except KeyError, msg:
|
||||
except KeyError as msg:
|
||||
final_dic = {'status': 0, 'erroMessage': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
Reference in New Issue
Block a user