From 9c0f4927ae12589c9e64fd48f841a15ff7027360 Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Fri, 17 Jun 2022 12:21:06 +0500 Subject: [PATCH] add lsws conversion to cli --- cli/cliParser.py | 1 + cli/cyberPanel.py | 12 +++++++++ serverStatus/serverStatusUtil.py | 44 +++++++++++++++++++++++++++++++- 3 files changed, 56 insertions(+), 1 deletion(-) diff --git a/cli/cliParser.py b/cli/cliParser.py index 00c7cb7d7..5f968afc3 100755 --- a/cli/cliParser.py +++ b/cli/cliParser.py @@ -63,6 +63,7 @@ class cliParser: parser.add_argument('--selectedACL', help='Select ACL 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('--licenseKey', help='LSWS License Key') ### WP Install diff --git a/cli/cyberPanel.py b/cli/cyberPanel.py index f17755e51..734136e70 100755 --- a/cli/cyberPanel.py +++ b/cli/cyberPanel.py @@ -1582,6 +1582,18 @@ def main(): wm = WebsiteManager() wm.installJoomla(1, data) + elif args.function == "switchTOLSWS": + + completeCommandExample = 'cyberpanel switchTOLSWS --licenseKey -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) + time.sleep(2) + + except BaseException as msg: + logging.CyberCPLogFileWriter.writeToFile(str(msg)) + + def main(): parser = argparse.ArgumentParser(description='Server Status Util.')