Properly use mariadb-admin instead of mysqladmin
This commit is contained in:
@@ -8,8 +8,8 @@ from pynginxconfig import NginxConfig
|
||||
|
||||
from wo.core.aptget import WOAptGet
|
||||
from wo.core.logging import Log
|
||||
from wo.core.shellexec import WOShellExec
|
||||
from wo.core.variables import WOVar
|
||||
from wo.core.mysql import WOMysql
|
||||
|
||||
|
||||
def wo_info_hook(app):
|
||||
@@ -598,11 +598,7 @@ class WOInfoController(CementBaseController):
|
||||
self.info_php()
|
||||
|
||||
if pargs.mysql:
|
||||
if os.path.exists('/usr/bin/mariadb-admin'):
|
||||
mariadb_admin = "/usr/bin/mariadb-admin"
|
||||
else:
|
||||
mariadb_admin = "/usr/bin/mysqladmin"
|
||||
if WOShellExec.cmd_exec(self, f"{mariadb_admin} ping"):
|
||||
if WOMysql.mariadb_ping(self):
|
||||
self.info_mysql()
|
||||
else:
|
||||
Log.info(self, "MySQL is not installed")
|
||||
|
||||
@@ -904,7 +904,7 @@ def site_package_check(self, stype):
|
||||
|
||||
if stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']:
|
||||
Log.debug(self, "Setting apt_packages variable for MySQL")
|
||||
if not WOShellExec.cmd_exec(self, "/usr/bin/mysqladmin ping"):
|
||||
if not WOMysql.mariadb_ping(self):
|
||||
apt_packages = apt_packages + WOVar.wo_mysql
|
||||
|
||||
if stype in ['wp', 'wpsubdir', 'wpsubdomain']:
|
||||
|
||||
@@ -208,7 +208,7 @@ class WOStackController(CementBaseController):
|
||||
if pargs.mysql:
|
||||
pargs.mysqltuner = True
|
||||
Log.debug(self, "Setting apt_packages variable for MySQL")
|
||||
if not WOShellExec.cmd_exec(self, "mysqladmin ping"):
|
||||
if not WOMysql.mariadb_ping(self):
|
||||
apt_packages = apt_packages + WOVar.wo_mysql
|
||||
else:
|
||||
Log.debug(self, "MySQL already installed and alive")
|
||||
@@ -218,7 +218,7 @@ class WOStackController(CementBaseController):
|
||||
if pargs.mysqlclient:
|
||||
Log.debug(self, "Setting apt_packages variable "
|
||||
"for MySQL Client")
|
||||
if not WOShellExec.cmd_exec(self, "mysqladmin ping"):
|
||||
if not WOMysql.mariadb_ping(self):
|
||||
apt_packages = apt_packages + WOVar.wo_mysql_client
|
||||
else:
|
||||
Log.debug(self, "MySQL already installed and alive")
|
||||
@@ -470,7 +470,7 @@ class WOStackController(CementBaseController):
|
||||
|
||||
# UTILS
|
||||
if pargs.utils:
|
||||
if not WOShellExec.cmd_exec(self, 'mysqladmin ping'):
|
||||
if not WOMysql.mariadb_ping(self):
|
||||
pargs.mysql = True
|
||||
if not (WOAptGet.is_installed(self, 'php7.2-fpm') or
|
||||
WOAptGet.is_installed(self, 'php7.3-fpm') or
|
||||
@@ -655,7 +655,7 @@ class WOStackController(CementBaseController):
|
||||
if pargs.mysqlclient:
|
||||
Log.debug(self, "Removing apt_packages variable "
|
||||
"for MySQL Client")
|
||||
if WOShellExec.cmd_exec(self, "mysqladmin ping"):
|
||||
if WOMysql.mariadb_ping(self):
|
||||
apt_packages = apt_packages + WOVar.wo_mysql_client
|
||||
|
||||
# fail2ban
|
||||
@@ -844,7 +844,7 @@ class WOStackController(CementBaseController):
|
||||
packages = packages + ["/opt/netdata"]
|
||||
else:
|
||||
Log.debug(self, "Netdata uninstaller not found")
|
||||
if WOShellExec.cmd_exec(self, 'mysqladmin ping'):
|
||||
if WOMysql.mariadb_ping(self):
|
||||
WOMysql.execute(
|
||||
self, "DELETE FROM mysql.user WHERE User = 'netdata';")
|
||||
|
||||
@@ -972,7 +972,7 @@ class WOStackController(CementBaseController):
|
||||
|
||||
# mysqlclient
|
||||
if pargs.mysqlclient:
|
||||
if WOShellExec.cmd_exec(self, "mysqladmin ping"):
|
||||
if WOMysql.mariadb_ping(self):
|
||||
Log.debug(self, "Add MySQL client to apt_packages list")
|
||||
apt_packages = apt_packages + WOVar.wo_mysql_client
|
||||
|
||||
@@ -1145,7 +1145,7 @@ class WOStackController(CementBaseController):
|
||||
packages = packages + ["/opt/netdata"]
|
||||
else:
|
||||
Log.debug(self, "Netdata uninstaller not found")
|
||||
if WOShellExec.cmd_exec(self, 'mysqladmin ping'):
|
||||
if WOMysql.mariadb_ping(self):
|
||||
WOMysql.execute(
|
||||
self, "DELETE FROM mysql.user WHERE User = 'netdata';")
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ class WOStackMigrateController(CementBaseController):
|
||||
@expose(hide=True)
|
||||
def migrate_mariadb(self, ci=False):
|
||||
|
||||
if WOShellExec.cmd_exec(self, 'mysqladmin ping'):
|
||||
if WOMysql.mariadb_ping(self):
|
||||
# Backup all database
|
||||
WOMysql.backupAll(self, fulldump=True)
|
||||
else:
|
||||
@@ -111,7 +111,7 @@ class WOStackMigrateController(CementBaseController):
|
||||
Log.error(
|
||||
self, "Remote MySQL server in use, skipping local install")
|
||||
|
||||
if WOShellExec.cmd_exec(self, "mysqladmin ping"):
|
||||
if WOMysql.mariadb_ping(self):
|
||||
|
||||
Log.info(self, "If your database size is big, "
|
||||
"migration may take some time.")
|
||||
|
||||
@@ -1144,7 +1144,7 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
||||
else:
|
||||
wo_grant_host = 'localhost'
|
||||
# check if mysql credentials are available
|
||||
if (WOShellExec.cmd_exec(self, "mysqladmin ping")
|
||||
if (WOMysql.mariadb_ping(self)
|
||||
and wo_grant_host == 'localhost'):
|
||||
try:
|
||||
WOMysql.execute(
|
||||
|
||||
@@ -12,6 +12,7 @@ from wo.core.logging import Log
|
||||
from wo.core.shellexec import WOShellExec
|
||||
from wo.core.variables import WOVar
|
||||
from wo.core.services import WOService
|
||||
from wo.core.mysql import WOMysql
|
||||
|
||||
|
||||
class WOStackUpgradeController(CementBaseController):
|
||||
@@ -152,7 +153,7 @@ class WOStackUpgradeController(CementBaseController):
|
||||
|
||||
# mysql
|
||||
if pargs.mysql:
|
||||
if WOShellExec.cmd_exec(self, 'mysqladmin ping'):
|
||||
if WOMysql.mariadb_ping(self):
|
||||
apt_packages = apt_packages + ['mariadb-server']
|
||||
|
||||
# redis
|
||||
|
||||
Reference in New Issue
Block a user