1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

enable mysql connection via unix socket

This commit is contained in:
Bjørnar Ness 2016-04-12 14:16:18 +02:00
parent 0ced20951f
commit d868cdc7b8

View file

@ -36,9 +36,7 @@ except ImportError:
mysqldb_found = False mysqldb_found = False
def mysql_connect(module, login_user=None, login_password=None, config_file='', ssl_cert=None, ssl_key=None, ssl_ca=None, db=None, cursor_class=None, connect_timeout=30): def mysql_connect(module, login_user=None, login_password=None, config_file='', ssl_cert=None, ssl_key=None, ssl_ca=None, db=None, cursor_class=None, connect_timeout=30):
config = { config = {}
'host': module.params['login_host']
}
if ssl_ca is not None or ssl_key is not None or ssl_cert is not None: if ssl_ca is not None or ssl_key is not None or ssl_cert is not None:
config['ssl'] = {} config['ssl'] = {}
@ -46,6 +44,7 @@ def mysql_connect(module, login_user=None, login_password=None, config_file='',
if module.params['login_unix_socket']: if module.params['login_unix_socket']:
config['unix_socket'] = module.params['login_unix_socket'] config['unix_socket'] = module.params['login_unix_socket']
else: else:
config['host'] = module.params['login_host']
config['port'] = module.params['login_port'] config['port'] = module.params['login_port']
if os.path.exists(config_file): if os.path.exists(config_file):