mysql_user: replace VALID_PRIVS by get_valid_privs() function (#217)

* mysql_user: replace VALID_PRIVS by get_valid_privs() function

* Add EXTRA_PRIVS in case we need to add more privs in the future

* Add changelog fragment
This commit is contained in:
R.Sicart 2021-09-23 11:53:37 +02:00 committed by GitHub
parent 4de0e25ea0
commit 0ce1fa1634
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 40 deletions

View file

@ -250,6 +250,7 @@ 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
@ -1013,7 +1014,8 @@ def main():
module.fail_json(msg=to_native(e))
try:
priv = privileges_unpack(priv, mode)
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))