mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Added login_unix_socket option to mysql_db module
This commit is contained in:
parent
7e9e29011e
commit
a2aa30f4e5
1 changed files with 5 additions and 1 deletions
|
@ -71,6 +71,7 @@ def main():
|
|||
login_user=dict(default=None),
|
||||
login_password=dict(default=None),
|
||||
login_host=dict(default="localhost"),
|
||||
login_unix_socket=dict(default=None),
|
||||
db=dict(required=True, aliases=['name']),
|
||||
encoding=dict(default=""),
|
||||
collation=dict(default=""),
|
||||
|
@ -103,6 +104,9 @@ def main():
|
|||
module.fail_json(msg="when supplying login arguments, both login_user and login_password must be provided")
|
||||
|
||||
try:
|
||||
if module.params["login_unix_socket"] != None:
|
||||
db_connection = MySQLdb.connect(host=module.params["login_host"], unix_socket=module.params["login_unix_socket"], user=login_user, passwd=login_password, db="mysql")
|
||||
else:
|
||||
db_connection = MySQLdb.connect(host=module.params["login_host"], user=login_user, passwd=login_password, db="mysql")
|
||||
cursor = db_connection.cursor()
|
||||
except Exception as e:
|
||||
|
|
Loading…
Reference in a new issue