@cryptotaxi247 / netdata-1 / commits / bc50c1d99

disable "my.cnf" parsing when using "pymysql"

Ilya committed Aug 7, 2017 at 09:52 UTC bc50c1d999f16be4818b8df1bf53b4dd7fb84ba7
1 file changed +9 -6
python.d/python_modules/base.py
+9 -6
@@ -999,17 +999,20 @@ class MySQLService(SimpleService):
999 def check(self):
1000 def get_connection_properties(conf, extra_conf):
1001 properties = dict()
1002 - if 'user' in conf and conf['user']:
1002 + if conf.get('user'):
1003 properties['user'] = conf['user']
1004 - if 'pass' in conf and conf['pass']:
1004 + if conf.get('pass'):
1005 properties['passwd'] = conf['pass']
1006 - if 'socket' in conf and conf['socket']:
1006 + if conf.get('socket'):
1007 properties['unix_socket'] = conf['socket']
1008 - elif 'host' in conf and conf['host']:
1008 + elif conf.get('host'):
1009 properties['host'] = conf['host']
1010 properties['port'] = int(conf.get('port', 3306))
1011 - elif 'my.cnf' in conf and conf['my.cnf']:
1012 - properties['read_default_file'] = conf['my.cnf']
1011 + elif conf.get('my.cnf'):
1012 + if MySQLdb.__name__ == 'pymysql':
1013 + self.error('"my.cnf" parsing is not working for pymysql')
1014 + else:
1015 + properties['read_default_file'] = conf['my.cnf']
1016 if isinstance(extra_conf, dict) and extra_conf:
1017 properties.update(extra_conf)
1018