bug fix: cyberpanel db

This commit is contained in:
usmannasir
2025-09-28 03:27:18 +05:00
parent 9336ade62a
commit db54c62010

View File

@@ -9,7 +9,7 @@ class mysqlUtilities:
""" """
Create database and user with improved error handling and validation Create database and user with improved error handling and validation
""" """
import logging import installLog as logging
# Validate input parameters # Validate input parameters
if not dbname or not dbuser or not dbpassword: if not dbname or not dbuser or not dbpassword:
@@ -44,7 +44,7 @@ class mysqlUtilities:
logging.InstallLog.writeToFile(f"Executing database creation: CREATE DATABASE IF NOT EXISTS {dbname}") logging.InstallLog.writeToFile(f"Executing database creation: CREATE DATABASE IF NOT EXISTS {dbname}")
if install.preFlightsChecks.debug: if hasattr(install, 'preFlightsChecks') and hasattr(install.preFlightsChecks, 'debug') and install.preFlightsChecks.debug:
print(command) print(command)
time.sleep(10) time.sleep(10)
@@ -71,7 +71,7 @@ class mysqlUtilities:
command = initCommand + dropUser + '"' command = initCommand + dropUser + '"'
logging.InstallLog.writeToFile(f"Dropping existing user '{dbuser}'@'{host}' if exists") logging.InstallLog.writeToFile(f"Dropping existing user '{dbuser}'@'{host}' if exists")
if install.preFlightsChecks.debug: if hasattr(install, 'preFlightsChecks') and hasattr(install.preFlightsChecks, 'debug') and install.preFlightsChecks.debug:
print(command) print(command)
time.sleep(10) time.sleep(10)
@@ -82,7 +82,7 @@ class mysqlUtilities:
command = initCommand + createUser + '"' command = initCommand + createUser + '"'
logging.InstallLog.writeToFile(f"Creating user '{dbuser}'@'{host}' with password") logging.InstallLog.writeToFile(f"Creating user '{dbuser}'@'{host}' with password")
if install.preFlightsChecks.debug: if hasattr(install, 'preFlightsChecks') and hasattr(install.preFlightsChecks, 'debug') and install.preFlightsChecks.debug:
print(command) print(command)
time.sleep(10) time.sleep(10)
@@ -104,7 +104,7 @@ class mysqlUtilities:
logging.InstallLog.writeToFile(f"Applying DigitalOcean MySQL compatibility for '{dbuser}'@'{publicip}'") logging.InstallLog.writeToFile(f"Applying DigitalOcean MySQL compatibility for '{dbuser}'@'{publicip}'")
if install.preFlightsChecks.debug: if hasattr(install, 'preFlightsChecks') and hasattr(install.preFlightsChecks, 'debug') and install.preFlightsChecks.debug:
print(command) print(command)
time.sleep(10) time.sleep(10)
@@ -128,7 +128,7 @@ class mysqlUtilities:
command = initCommand + grantPrivileges + '"' command = initCommand + grantPrivileges + '"'
logging.InstallLog.writeToFile(f"Granting privileges on database '{dbname}' to user '{dbuser}'@'{host}'") logging.InstallLog.writeToFile(f"Granting privileges on database '{dbname}' to user '{dbuser}'@'{host}'")
if install.preFlightsChecks.debug: if hasattr(install, 'preFlightsChecks') and hasattr(install.preFlightsChecks, 'debug') and install.preFlightsChecks.debug:
print(command) print(command)
time.sleep(10) time.sleep(10)