From 2ed72a53da64eea6e7a44c9a2abf1a73b47ae3dd Mon Sep 17 00:00:00 2001 From: "R. Sicart" Date: Wed, 31 Aug 2022 17:17:07 +0200 Subject: [PATCH] Avoid pointless revocations when ALL are granted --- plugins/module_utils/user.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/module_utils/user.py b/plugins/module_utils/user.py index 0b1b306..b234d72 100644 --- a/plugins/module_utils/user.py +++ b/plugins/module_utils/user.py @@ -363,7 +363,11 @@ def user_mod(cursor, user, host, host_all, password, encrypted, grant_privs = list(set(new_priv[db_table]) - set(curr_priv[db_table])) revoke_privs = list(set(curr_priv[db_table]) - set(new_priv[db_table])) - # ... but only revoke grant option if it exists and absence is requested + # ... avoiding pointless revocations when ALL are granted + if 'ALL' in grant_privs or 'ALL PRIVILEGES' in grant_privs: + revoke_privs = list({'GRANT', 'PROXY'} & set(revoke_privs)) + + # Only revoke grant option if it exists and absence is requested # # For more details # https://github.com/ansible-collections/community.mysql/issues/77#issuecomment-1209693807