From 4942fd582c2308317e370478476665ac64fd49c2 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Thu, 16 Oct 2025 10:01:45 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20case=20when=20grant=20options=20is=20set?= =?UTF-8?q?=20with=20no=20other=20user=20permissions=20in=E2=80=A6=20(#744?= =?UTF-8?q?)=20(#750)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: case when grant options is set with no other user permissions in mariadb * Create changelog fragment * fix: wrong file name ext * Update changelogs/fragments/fix_user_perms_revoke_grant_option.yml --------- (cherry picked from commit 1cb9f369d0f8a89bd81b6b99ce07e95beeb7459c) Co-authored-by: george2asenov Co-authored-by: Andrew Klychkov --- changelogs/fragments/fix_user_perms_revoke_grant_option.yml | 2 ++ plugins/module_utils/user.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/fix_user_perms_revoke_grant_option.yml diff --git a/changelogs/fragments/fix_user_perms_revoke_grant_option.yml b/changelogs/fragments/fix_user_perms_revoke_grant_option.yml new file mode 100644 index 0000000..46b47b4 --- /dev/null +++ b/changelogs/fragments/fix_user_perms_revoke_grant_option.yml @@ -0,0 +1,2 @@ +bugfixes: + - mysql_user, mysql_role - fix not existent grant when revoking perms on user/role which do not have any other perms than grant option (https://github.com/ansible-collections/community.mysql/issues/664). diff --git a/plugins/module_utils/user.py b/plugins/module_utils/user.py index 59f9b01..0c913ee 100644 --- a/plugins/module_utils/user.py +++ b/plugins/module_utils/user.py @@ -886,7 +886,7 @@ def privileges_revoke(cursor, user, host, db_table, priv, grant_option, maria_ro cursor.execute(query, (user, host)) priv_string = ",".join([p for p in priv if p not in ('GRANT', )]) - if priv_string != "": + if priv_string != "" and not (grant_option and priv_string == "USAGE"): query = ["REVOKE %s ON %s" % (priv_string, db_table)] if not maria_role: