convert to lsws ent via cli

This commit is contained in:
Usman Nasir
2022-06-07 15:14:03 +05:00
parent a02b46a79c
commit adcf7d2d0a
3 changed files with 45 additions and 0 deletions

View File

@@ -70,4 +70,9 @@ class cliParser:
parser.add_argument('--siteTitle', help='Site Title for application installers.')
parser.add_argument('--path', help='Path for application installers.')
### Convert to LSWS Ent via cli
parser.add_argument('--licenseKey', help='LiteSpeed Enterprise License key')
return parser.parse_args()

View File

@@ -1582,6 +1582,18 @@ def main():
wm = WebsiteManager()
wm.installJoomla(1, data)
elif args.function == "switchTOLSWS":
completeCommandExample = 'cyberpanel switchTOLSWS --licenseKey <Your lsws key here or you can enter TRIAL)'
if not args.licenseKey:
print("\n\nPlease enter LiteSpeed License key. For example:\n\n" + completeCommandExample + "\n\n")
return
from serverStatus.serverStatusUtil import ServerStatusUtil
ServerStatusUtil.switchTOLSWSCLI(args.licenseKey)
if __name__ == "__main__":
main()

View File

@@ -379,6 +379,34 @@ class ServerStatusUtil:
logging.CyberCPLogFileWriter.writeToFile(str(msg))
ServerStatusUtil.recover()
@staticmethod
def switchTOLSWSCLI(licenseKey):
try:
ServerStatusUtil.switchTOLSWS(licenseKey)
command = 'sudo cat ' + ServerStatusUtil.lswsInstallStatusPath
output = ProcessUtilities.outputExecutioner(command)
if output.find('[404]') > -1:
command = "sudo rm -f " + ServerStatusUtil.lswsInstallStatusPath
ProcessUtilities.popenExecutioner(command)
data_ret = {'status': 1, 'abort': 1, 'requestStatus': output, 'installed': 0}
print(str(data_ret))
return 0
elif output.find('[200]') > -1:
command = "sudo rm -f " + ServerStatusUtil.lswsInstallStatusPath
ProcessUtilities.popenExecutioner(command)
data_ret = {'status': 1, 'abort': 1, 'requestStatus': 'Successfully converted.', 'installed': 1}
print(str(data_ret))
return 1
else:
data_ret = {'status': 1, 'abort': 0, 'requestStatus': output, 'installed': 0}
print(output)
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg))
def main():
parser = argparse.ArgumentParser(description='Server Status Util.')