diff options
author | Ilya <ilyamaschenko@gmail.com> | 2017-08-07 09:52:30 +0900 |
---|---|---|
committer | Ilya <ilyamaschenko@gmail.com> | 2017-08-07 09:52:30 +0900 |
commit | bc50c1d999f16be4818b8df1bf53b4dd7fb84ba7 (patch) | |
tree | 5c81a1bd62056aec11688650581c34b951c80d7b /python.d | |
parent | df957395370e656a9961a5b3cfa8d4db80801282 (diff) |
disable "my.cnf" parsing when using "pymysql"
Diffstat (limited to 'python.d')
-rw-r--r-- | python.d/python_modules/base.py | 15 |
1 files changed, 9 insertions, 6 deletions
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) |