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] ### v3.9.x - [Unreleased]
#### Fixed
- MySQL databases backup when using remote MySQL server
### v3.11.4 - 2020-01-17 ### v3.11.4 - 2020-01-17
#### Fixed #### Fixed

View File

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

View File

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