Get rid of privs comparison (#243)

* Remove all code related to VALID_PRIVS and get_valid_privs()

* Add tests to update user with invalid privs

* Re-raise InvalidPrivsError when granting privileges

* Fix: compatibility with python2

* More explicit assertions as commented by Andersson007

* Add changelog fragment
This commit is contained in:
R.Sicart 2021-11-20 09:28:40 +01:00 committed by GitHub
parent e4de13aabe
commit 727b638d13
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 45 additions and 66 deletions

View file

@ -318,7 +318,6 @@ from ansible_collections.community.mysql.plugins.module_utils.user import (
handle_requiressl_in_priv_string,
InvalidPrivsError,
limit_resources,
get_valid_privs,
privileges_unpack,
sanitize_requires,
user_add,
@ -421,11 +420,7 @@ def main():
mode = get_mode(cursor)
except Exception as e:
module.fail_json(msg=to_native(e))
try:
valid_privs = get_valid_privs(cursor)
priv = privileges_unpack(priv, mode, valid_privs)
except Exception as e:
module.fail_json(msg="invalid privileges string: %s" % to_native(e))
priv = privileges_unpack(priv, mode)
if state == "present":
if user_exists(cursor, user, host, host_all):