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
|
@ -175,6 +175,7 @@ def main():
|
|||
variable=dict(type='str'),
|
||||
value=dict(type='str'),
|
||||
mode=dict(type='str', choices=['global', 'persist', 'persist_only'], default='global'),
|
||||
protocol=dict(type='str', default=None, choices=['tcp', 'socket', 'pipe', 'memory']),
|
||||
)
|
||||
|
||||
module = AnsibleModule(
|
||||
|
@ -193,6 +194,7 @@ def main():
|
|||
mysqlvar = module.params["variable"]
|
||||
value = module.params["value"]
|
||||
mode = module.params["mode"]
|
||||
protocol = module.params["protocol"]
|
||||
|
||||
if mysqlvar is None:
|
||||
module.fail_json(msg="Cannot run without variable to operate with")
|
||||
|
@ -204,8 +206,10 @@ def main():
|
|||
warnings.filterwarnings('error', category=mysql_driver.Warning)
|
||||
|
||||
try:
|
||||
cursor, db_conn = mysql_connect(module, user, password, config_file, ssl_cert, ssl_key, ssl_ca, db,
|
||||
connect_timeout=connect_timeout, check_hostname=check_hostname)
|
||||
cursor, db_conn = mysql_connect(
|
||||
module, user, password, config_file, ssl_cert, ssl_key, ssl_ca, db, protocol,
|
||||
connect_timeout=connect_timeout, check_hostname=check_hostname
|
||||
)
|
||||
except Exception as e:
|
||||
if os.path.exists(config_file):
|
||||
module.fail_json(msg=("unable to connect to database, check login_user and "
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue