From b8d647454040c56e8081433615288dc84f05ac7a Mon Sep 17 00:00:00 2001 From: Alexander Skiba Date: Wed, 1 Feb 2023 09:37:37 +0100 Subject: [PATCH] mysql_role: enable autocommit (#500) * mysql_role: enable autocommit * Add changelog fragment --- changelogs/fragments/479_enable_auto_commit_part2.yml | 3 +++ plugins/modules/mysql_role.py | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/479_enable_auto_commit_part2.yml diff --git a/changelogs/fragments/479_enable_auto_commit_part2.yml b/changelogs/fragments/479_enable_auto_commit_part2.yml new file mode 100644 index 0000000..a447acf --- /dev/null +++ b/changelogs/fragments/479_enable_auto_commit_part2.yml @@ -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). diff --git a/plugins/modules/mysql_role.py b/plugins/modules/mysql_role.py index 01cb625..070d793 100644 --- a/plugins/modules/mysql_role.py +++ b/plugins/modules/mysql_role.py @@ -1008,7 +1008,8 @@ 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 @@ -1016,7 +1017,8 @@ def main(): 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, '