Skip to content

Commit

Permalink
Document MySQL and MariaDB don't store roles with same manner (#584)
Browse files Browse the repository at this point in the history
(cherry picked from commit 0dbedf5)
  • Loading branch information
laurent-indermuehle authored and patchback[bot] committed Oct 26, 2023
1 parent 57d9ba0 commit 45aa359
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions plugins/module_utils/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,14 @@ def privileges_grant(cursor, user, host, db_table, priv, tls_requires, maria_rol
priv_string = ",".join([p for p in priv if p not in ('GRANT', )])
query = ["GRANT %s ON %s" % (priv_string, db_table)]

# MySQL and MariaDB don't store roles in the user table the same manner:
# select user, host from mysql.user;
# +------------------+-----------+
# | user | host |
# +------------------+-----------+
# | role_foo | % | <- MySQL
# | role_foo | | <- MariaDB
# +------------------+-----------+
if not maria_role:
query.append("TO %s@%s")
params = (user, host)
Expand Down

0 comments on commit 45aa359

Please sign in to comment.