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

@ -250,7 +250,6 @@ from ansible_collections.community.mysql.plugins.module_utils.user import (
get_mode,
user_mod,
privileges_grant,
get_valid_privs,
privileges_unpack,
)
from ansible.module_utils._text import to_native
@ -1014,8 +1013,7 @@ def main():
module.fail_json(msg=to_native(e))
try:
valid_privs = get_valid_privs(cursor)
priv = privileges_unpack(priv, mode, valid_privs)
priv = privileges_unpack(priv, mode)
except Exception as e:
module.fail_json(msg='Invalid privileges string: %s' % to_native(e))