Fix MySQL purge with remote MySQL server

This commit is contained in:
VirtuBox
2020-01-21 12:44:07 +01:00
parent 87e46d9145
commit a40a96c3e3
3 changed files with 13 additions and 13 deletions

View File

@@ -8,6 +8,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### v3.9.x - [Unreleased]
#### Fixed
- MySQL databases backup when using remote MySQL server
### v3.11.4 - 2020-01-17
#### Fixed

View File

@@ -1123,20 +1123,17 @@ class WOStackController(CementBaseController):
if start_purge != "Y" and start_purge != "y":
Log.error(self, "Not starting stack purge")
if (set(["nginx-custom"]).issubset(set(apt_packages))):
if "nginx-custom" in apt_packages:
WOService.stop_service(self, 'nginx')
if (set(["fail2ban"]).issubset(set(apt_packages))):
if "fail2ban" in apt_packages:
WOService.stop_service(self, 'fail2ban')
if (set(["mariadb-server"]).issubset(set(apt_packages))):
if self.app.config.has_section('stack'):
database_host = self.app.config.get(
'stack', 'ip-address')
else:
database_host = 'na'
if database_host == '127.0.0.1':
WOMysql.backupAll(self)
if "mariadb-server" in apt_packages:
if self.app.config.has_section('mysql'):
if self.app.config.get(
'mysql', 'grant-host') == 'localhost':
WOMysql.backupAll(self)
WOService.stop_service(self, 'mysql')
# Netdata uninstaller

View File

@@ -31,9 +31,8 @@ class WOMysql():
# Makes connection with MySQL server
try:
if os.path.exists('/etc/mysql/conf.d/my.cnf'):
connection = \
pymysql.connect(read_default_file='/etc/mysql/'
'conf.d/my.cnf')
connection = pymysql.connect(
read_default_file='/etc/mysql/conf.d/my.cnf')
else:
connection = pymysql.connect(read_default_file='~/.my.cnf')
return connection