[stable-2] Backport stable 2 4 (#219)

* Fix wrong impl for mysql (#210)

If 'mariadb' in version info, the db instance should be mariadb(reverse in code) rather than mysql.

(cherry picked from commit 663590689f)

* Update README.md (#216)

(cherry picked from commit 4de0e25ea0)

* 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

(cherry picked from commit 0ce1fa1634)

Co-authored-by: int32bit <krystism@gmail.com>
Co-authored-by: R.Sicart <roger.sicart@gmail.com>
This commit is contained in:
Andrew Klychkov 2021-09-23 13:51:32 +03:00 committed by GitHub
parent 0c462c84ff
commit c5676ff0c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 44 deletions

View file

@ -318,6 +318,7 @@ 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,7 +422,8 @@ def main():
except Exception as e:
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))