mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-08 06:16:08 +01:00
bug fix: lsws converter
This commit is contained in:
@@ -63,6 +63,7 @@ class cliParser:
|
|||||||
parser.add_argument('--selectedACL', help='Select ACL while creating user.')
|
parser.add_argument('--selectedACL', help='Select ACL while creating user.')
|
||||||
parser.add_argument('--securityLevel', help='Set security level while creating user.')
|
parser.add_argument('--securityLevel', help='Set security level while creating user.')
|
||||||
parser.add_argument('--state', help='State value used in user suspension.')
|
parser.add_argument('--state', help='State value used in user suspension.')
|
||||||
|
parser.add_argument('--licenseKey', help='LSWS License Key')
|
||||||
|
|
||||||
|
|
||||||
### WP Install
|
### WP Install
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#!/usr/local/CyberCP/bin/python
|
#!/usr/local/CyberCP/bin/python
|
||||||
import os,sys
|
import os,sys
|
||||||
|
import time
|
||||||
sys.path.append('/usr/local/CyberCP')
|
sys.path.append('/usr/local/CyberCP')
|
||||||
import django
|
import django
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
|
||||||
@@ -15,12 +16,21 @@ from plogical.virtualHostUtilities import virtualHostUtilities
|
|||||||
from plogical.sslUtilities import sslUtilities
|
from plogical.sslUtilities import sslUtilities
|
||||||
from plogical.vhost import vhost
|
from plogical.vhost import vhost
|
||||||
from shutil import ignore_patterns
|
from shutil import ignore_patterns
|
||||||
|
import threading as multi
|
||||||
|
|
||||||
|
|
||||||
class ServerStatusUtil:
|
class ServerStatusUtil(multi.Thread):
|
||||||
|
|
||||||
lswsInstallStatusPath = '/home/cyberpanel/switchLSWSStatus'
|
lswsInstallStatusPath = '/home/cyberpanel/switchLSWSStatus'
|
||||||
serverRootPath = '/usr/local/lsws/'
|
serverRootPath = '/usr/local/lsws/'
|
||||||
|
|
||||||
|
def __init__(self, key):
|
||||||
|
multi.Thread.__init__(self)
|
||||||
|
self.key = key
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
self.switchTOLSWS(self.key)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def executioner(command, statusFile):
|
def executioner(command, statusFile):
|
||||||
try:
|
try:
|
||||||
@@ -383,26 +393,28 @@ class ServerStatusUtil:
|
|||||||
def switchTOLSWSCLI(licenseKey):
|
def switchTOLSWSCLI(licenseKey):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
ServerStatusUtil.switchTOLSWS(licenseKey)
|
ssu = ServerStatusUtil(licenseKey)
|
||||||
|
ssu.start()
|
||||||
|
|
||||||
command = 'sudo cat ' + ServerStatusUtil.lswsInstallStatusPath
|
while(True):
|
||||||
output = ProcessUtilities.outputExecutioner(command)
|
command = 'sudo cat ' + ServerStatusUtil.lswsInstallStatusPath
|
||||||
|
output = ProcessUtilities.outputExecutioner(command)
|
||||||
if output.find('[404]') > -1:
|
if output.find('[404]') > -1:
|
||||||
command = "sudo rm -f " + ServerStatusUtil.lswsInstallStatusPath
|
command = "sudo rm -f " + ServerStatusUtil.lswsInstallStatusPath
|
||||||
ProcessUtilities.popenExecutioner(command)
|
ProcessUtilities.popenExecutioner(command)
|
||||||
data_ret = {'status': 1, 'abort': 1, 'requestStatus': output, 'installed': 0}
|
data_ret = {'status': 1, 'abort': 1, 'requestStatus': output, 'installed': 0}
|
||||||
print(str(data_ret))
|
print(str(data_ret))
|
||||||
return 0
|
return 0
|
||||||
elif output.find('[200]') > -1:
|
elif output.find('[200]') > -1:
|
||||||
command = "sudo rm -f " + ServerStatusUtil.lswsInstallStatusPath
|
command = "sudo rm -f " + ServerStatusUtil.lswsInstallStatusPath
|
||||||
ProcessUtilities.popenExecutioner(command)
|
ProcessUtilities.popenExecutioner(command)
|
||||||
data_ret = {'status': 1, 'abort': 1, 'requestStatus': 'Successfully converted.', 'installed': 1}
|
data_ret = {'status': 1, 'abort': 1, 'requestStatus': 'Successfully converted.', 'installed': 1}
|
||||||
print(str(data_ret))
|
print(str(data_ret))
|
||||||
return 1
|
return 1
|
||||||
else:
|
else:
|
||||||
data_ret = {'status': 1, 'abort': 0, 'requestStatus': output, 'installed': 0}
|
data_ret = {'status': 1, 'abort': 0, 'requestStatus': output, 'installed': 0}
|
||||||
print(output)
|
#print(output)
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||||
|
|||||||
Reference in New Issue
Block a user