Merge branch 'master' into production

This commit is contained in:
Michael Herzberg 2019-01-23 16:49:32 +00:00
commit 1b5c75c57c
1 changed files with 18 additions and 0 deletions

View File

@ -20,6 +20,7 @@ import datetime
from collections import OrderedDict
from random import uniform
import sys
import configparser
import MySQLdb
import _mysql_exceptions
@ -42,6 +43,23 @@ class MysqlBackend:
self.db = None
self.cursor = None
# For more info, see https://jira.mariadb.org/browse/CONC-359
self._fix_missing_host(self.dbargs)
def _fix_missing_host(self, dbargs):
if "host" in dbargs:
return
if "read_default_file" not in dbargs:
return
config = configparser.ConfigParser()
config.read(dbargs["read_default_file"])
if "host" not in config["client"]:
return
dbargs["host"] = config["client"]["host"]
def __enter__(self):
# We open a connection once we actually need it
return self