Dynamically add ssl key to the mysql config hash iff needed

Just including the `ssl` key in the config for MySQLdb.connect, causes it to check for the existence of SSL support. This patch only adds the key if one of the ssl configuration options is included.
pull/14924/head
mvgrimes 9 years ago
parent ab682b2917
commit e613737b80

@ -31,11 +31,12 @@
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'], 'host': module.params['login_host']
'ssl': {
}
} }
if ssl_ca is not None or ssl_key is not None or ssl_cert is not None:
config['ssl'] = {}
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:

Loading…
Cancel
Save