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 d3d99ea..2763305 100644 --- a/plugins/module_utils/user.py +++ b/plugins/module_utils/user.py @@ -885,7 +885,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: