From bc50c1d999f16be4818b8df1bf53b4dd7fb84ba7 Mon Sep 17 00:00:00 2001 From: Ilya Date: Mon, 7 Aug 2017 09:52:30 +0900 Subject: disable "my.cnf" parsing when using "pymysql" --- python.d/python_modules/base.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'python.d') diff --git a/python.d/python_modules/base.py b/python.d/python_modules/base.py index cbe5aaf9e3..1d5417ec2b 100644 --- a/python.d/python_modules/base.py +++ b/python.d/python_modules/base.py @@ -999,17 +999,20 @@ class MySQLService(SimpleService): def check(self): def get_connection_properties(conf, extra_conf): properties = dict() - if 'user' in conf and conf['user']: + if conf.get('user'): properties['user'] = conf['user'] - if 'pass' in conf and conf['pass']: + if conf.get('pass'): properties['passwd'] = conf['pass'] - if 'socket' in conf and conf['socket']: + if conf.get('socket'): properties['unix_socket'] = conf['socket'] - elif 'host' in conf and conf['host']: + elif conf.get('host'): properties['host'] = conf['host'] properties['port'] = int(conf.get('port', 3306)) - elif 'my.cnf' in conf and conf['my.cnf']: - properties['read_default_file'] = conf['my.cnf'] + elif conf.get('my.cnf'): + if MySQLdb.__name__ == 'pymysql': + self.error('"my.cnf" parsing is not working for pymysql') + else: + properties['read_default_file'] = conf['my.cnf'] if isinstance(extra_conf, dict) and extra_conf: properties.update(extra_conf) -- cgit v1.2.3