bug fix: amazon rds

This commit is contained in:
Usman Nasir
2020-08-26 11:44:23 +05:00
parent 7040b3ee9e
commit 2404080530
2 changed files with 14 additions and 2 deletions

View File

@@ -26,6 +26,7 @@ import argparse
class mysqlUtilities:
LOCALHOST = 'localhost'
RDS = 0
@staticmethod
def getPagination(records, toShow):
@@ -67,6 +68,9 @@ class mysqlUtilities:
mysqlport = jsonData['mysqlport']
mysqlhost = jsonData['mysqlhost']
if mysqlhost.find('rds.amazon') > -1:
mysqlUtilities.RDS = 1
## Also set localhost to this server
ipFile = "/etc/cyberpanel/machineIP"
@@ -148,7 +152,12 @@ class mysqlUtilities:
if connection == 0:
return 0
cursor.execute("GRANT ALL PRIVILEGES ON " + dbName + ".* TO '" + globalUser + "'@'%s'" % (mysqlUtilities.LOCALHOST))
if mysqlUtilities.RDS == 0:
cursor.execute("GRANT ALL PRIVILEGES ON " + dbName + ".* TO '" + globalUser + "'@'%s'" % (mysqlUtilities.LOCALHOST))
else:
cursor.execute("GRANT SELECT, INSERT, DELETE ON " + dbName + ".* TO '" + globalUser + "'@'%s'" % (
mysqlUtilities.LOCALHOST))
connection.close()
return 1