Skip to content

Commit

Permalink
mysql_role: enable autocommit (#500)
Browse files Browse the repository at this point in the history
* mysql_role: enable autocommit

* Add changelog fragment
  • Loading branch information
GhostLyrics authored Feb 1, 2023
1 parent a5f3296 commit b8d6474
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions changelogs/fragments/479_enable_auto_commit_part2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
minor_changes:
- mysql_role - enable auto_commit to avoid MySQL metadata table lock (https://github.com/ansible-collections/community.mysql/issues/479).
6 changes: 4 additions & 2 deletions plugins/modules/mysql_role.py
Original file line number Diff line number Diff line change
Expand Up @@ -1008,15 +1008,17 @@ def main():
cursor, db_conn = mysql_connect(module, 'root', '', config_file,
ssl_cert, ssl_key, ssl_ca, db,
connect_timeout=connect_timeout,
check_hostname=check_hostname)
check_hostname=check_hostname,
autocommit=True)
except Exception:
pass

if not cursor:
cursor, db_conn = mysql_connect(module, login_user, login_password,
config_file, ssl_cert, ssl_key,
ssl_ca, db, connect_timeout=connect_timeout,
check_hostname=check_hostname)
check_hostname=check_hostname,
autocommit=True)

except Exception as e:
module.fail_json(msg='unable to connect to database, '
Expand Down

0 comments on commit b8d6474

Please sign in to comment.