mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-08-04 05:04:23 -07:00
Add --protocol=TCP {TCP|SOCKET|PIPE|MEMORY} support
- Hopefully it works "as is", otherwise I will enhance until PR get ready to be merged let discuss it
This commit is contained in:
parent
cbdf51234a
commit
4786a40f9d
6 changed files with 75 additions and 26 deletions
|
@ -526,6 +526,7 @@ def main():
|
|||
filter=dict(type='list'),
|
||||
exclude_fields=dict(type='list'),
|
||||
return_empty_dbs=dict(type='bool', default=False),
|
||||
protocol=dict(type='str', default=None, choices=['tcp', 'socket', 'pipe', 'memory']),
|
||||
)
|
||||
|
||||
module = AnsibleModule(
|
||||
|
@ -545,6 +546,7 @@ def main():
|
|||
filter_ = module.params['filter']
|
||||
exclude_fields = module.params['exclude_fields']
|
||||
return_empty_dbs = module.params['return_empty_dbs']
|
||||
protocol = module.params['protocol']
|
||||
|
||||
if filter_:
|
||||
filter_ = [f.strip() for f in filter_]
|
||||
|
@ -556,10 +558,11 @@ def main():
|
|||
module.fail_json(msg=mysql_driver_fail_msg)
|
||||
|
||||
try:
|
||||
cursor, db_conn = mysql_connect(module, login_user, login_password,
|
||||
config_file, ssl_cert, ssl_key, ssl_ca, db,
|
||||
check_hostname=check_hostname,
|
||||
connect_timeout=connect_timeout, cursor_class='DictCursor')
|
||||
cursor, db_conn = mysql_connect(
|
||||
module, login_user, login_password, config_file,
|
||||
ssl_cert, ssl_key, ssl_ca, db, protocol,
|
||||
check_hostname=check_hostname,
|
||||
connect_timeout=connect_timeout, cursor_class='DictCursor')
|
||||
except Exception as e:
|
||||
module.fail_json(msg="unable to connect to database, check login_user and login_password are correct or %s has the credentials. "
|
||||
"Exception message: %s" % (config_file, to_native(e)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue