From 9f1bb1cfe4815274e8c11e99a0f388a699b06034 Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Thu, 25 Mar 2021 23:39:03 +0500 Subject: [PATCH] add loging to db creation --- install/installCyberPanel.py | 12 ++++++------ plogical/mysqlUtilities.py | 7 +++++++ serverStatus/serverStatusUtil.py | 27 +++++++++++++-------------- 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/install/installCyberPanel.py b/install/installCyberPanel.py index 467f4045b..82324db45 100755 --- a/install/installCyberPanel.py +++ b/install/installCyberPanel.py @@ -87,20 +87,20 @@ class InstallCyberPanel: except: pass - command = 'wget https://www.litespeedtech.com/packages/5.0/lsws-5.4.2-ent-x86_64-linux.tar.gz' + command = 'wget https://www.litespeedtech.com/packages/6.0/lsws-6.0-ent-x86_64-linux.tar.gz' install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) - command = 'tar zxf lsws-5.4.2-ent-x86_64-linux.tar.gz' + command = 'tar zxf lsws-6.0-ent-x86_64-linux.tar.gz' install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) - writeSerial = open('lsws-5.4.2/serial.no', 'w') + writeSerial = open('lsws-6.0/serial.no', 'w') writeSerial.writelines(self.serial) writeSerial.close() - shutil.copy('litespeed/install.sh', 'lsws-5.3.5/') - shutil.copy('litespeed/functions.sh', 'lsws-5.3.5/') + shutil.copy('litespeed/install.sh', 'lsws-6.0/') + shutil.copy('litespeed/functions.sh', 'lsws-6.0/') - os.chdir('lsws-5.3.5') + os.chdir('lsws-6.0') command = 'chmod +x install.sh' install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) diff --git a/plogical/mysqlUtilities.py b/plogical/mysqlUtilities.py index bebd28639..30cfc9707 100755 --- a/plogical/mysqlUtilities.py +++ b/plogical/mysqlUtilities.py @@ -124,13 +124,20 @@ class mysqlUtilities: query = "CREATE USER '" + dbuser + "'@'%s' IDENTIFIED BY '" % ( mysqlUtilities.LOCALHOST) + dbpassword + "'" + if os.path.exists(ProcessUtilities.debugPath): + logging.CyberCPLogFileWriter.writeToFile(query) + cursor.execute(query) if mysqlUtilities.RDS == 0: cursor.execute("GRANT ALL PRIVILEGES ON " + dbname + ".* TO '" + dbuser + "'@'%s'" % (mysqlUtilities.LOCALHOST)) + if os.path.exists(ProcessUtilities.debugPath): + logging.CyberCPLogFileWriter.writeToFile("GRANT ALL PRIVILEGES ON " + dbname + ".* TO '" + dbuser + "'@'%s'" % (mysqlUtilities.LOCALHOST)) else: cursor.execute( "GRANT INDEX, DROP, UPDATE, ALTER, CREATE, SELECT, INSERT, DELETE ON " + dbname + ".* TO '" + dbuser + "'@'%s'" % (mysqlUtilities.LOCALHOST)) + if os.path.exists(ProcessUtilities.debugPath): + logging.CyberCPLogFileWriter.writeToFile("GRANT INDEX, DROP, UPDATE, ALTER, CREATE, SELECT, INSERT, DELETE ON " + dbname + ".* TO '" + dbuser + "'@'%s'" % (mysqlUtilities.LOCALHOST)) connection.close() return 1 diff --git a/serverStatus/serverStatusUtil.py b/serverStatus/serverStatusUtil.py index d0deb1533..83a18d9f3 100755 --- a/serverStatus/serverStatusUtil.py +++ b/serverStatus/serverStatusUtil.py @@ -57,35 +57,34 @@ class ServerStatusUtil: except: pass - command = 'wget https://www.litespeedtech.com/packages/5.0/lsws-5.4.2-ent-x86_64-linux.tar.gz' + command = 'wget https://www.litespeedtech.com/packages/6.0/lsws-6.0-ent-x86_64-linux.tar.gz' if ServerStatusUtil.executioner(command, statusFile) == 0: return 0 - if os.path.exists('/usr/local/CyberCP/lsws-5.3.8/'): - shutil.rmtree('/usr/local/CyberCP/lsws-5.3.8') + if os.path.exists('/usr/local/CyberCP/lsws-6.0/'): + shutil.rmtree('/usr/local/CyberCP/lsws-6.0') + + if os.path.exists('/usr/local/CyberCP/lsws-6.0/'): + shutil.rmtree('/usr/local/CyberCP/lsws-6.0/') - if os.path.exists('/usr/local/CyberCP/lsws-5.4.2/'): - shutil.rmtree('/usr/local/CyberCP/lsws-5.4.2/') - - - command = 'tar zxf lsws-5.4.2-ent-x86_64-linux.tar.gz -C /usr/local/CyberCP' + command = 'tar zxf lsws-6.0-ent-x86_64-linux.tar.gz -C /usr/local/CyberCP' if ServerStatusUtil.executioner(command, statusFile) == 0: return 0 if licenseKey == 'trial': - command = 'wget -q --output-document=/usr/local/CyberCP/lsws-5.4.2/trial.key http://license.litespeedtech.com/reseller/trial.key' + command = 'wget -q --output-document=/usr/local/CyberCP/lsws-6.0/trial.key http://license.litespeedtech.com/reseller/trial.key' if ServerStatusUtil.executioner(command, statusFile) == 0: return 0 else: - writeSerial = open('/usr/local/CyberCP/lsws-5.4.2/serial.no', 'w') + writeSerial = open('/usr/local/CyberCP/lsws-6.0/serial.no', 'w') writeSerial.writelines(licenseKey) writeSerial.close() - shutil.copy('/usr/local/CyberCP/serverStatus/litespeed/install.sh', '/usr/local/CyberCP/lsws-5.4.2/') - shutil.copy('/usr/local/CyberCP/serverStatus/litespeed/functions.sh', '/usr/local/CyberCP/lsws-5.4.2/') + shutil.copy('/usr/local/CyberCP/serverStatus/litespeed/install.sh', '/usr/local/CyberCP/lsws-6.0/') + shutil.copy('/usr/local/CyberCP/serverStatus/litespeed/functions.sh', '/usr/local/CyberCP/lsws-6.0/') - os.chdir('/usr/local/CyberCP/lsws-5.4.2/') + os.chdir('/usr/local/CyberCP/lsws-6.0/') command = 'chmod +x install.sh' if ServerStatusUtil.executioner(command, statusFile) == 0: @@ -112,7 +111,7 @@ class ServerStatusUtil: pass try: - os.rmdir("/usr/local/CyberCP/lsws-5.4.2") + os.rmdir("/usr/local/CyberCP/lsws-6.0") except: pass