mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-04-19 00:41:31 -07:00
* mysql_user: Fixed change detection with append_privs (#69) Prior to this change, mysql_user with append_privs would attempt to make a change even if the current privileges were a superset of the new privileges (shouldn't require any action). * Fixed unrelated mysql_replication doc causing failures in CI * Added fragments and check_mode tests * Expanded priv append tests to cover additional case
This commit is contained in:
parent
d309d5af2d
commit
20f9699199
6 changed files with 133 additions and 1 deletions
|
@ -665,7 +665,14 @@ def user_mod(cursor, user, host, host_all, password, encrypted,
|
|||
# and in the new privileges, then we need to see if there's a difference.
|
||||
db_table_intersect = set(new_priv.keys()) & set(curr_priv.keys())
|
||||
for db_table in db_table_intersect:
|
||||
priv_diff = set(new_priv[db_table]) ^ set(curr_priv[db_table])
|
||||
|
||||
# If appending privileges, only the set difference between new privileges and current privileges matter.
|
||||
# The symmetric difference isn't relevant for append because existing privileges will not be revoked.
|
||||
if append_privs:
|
||||
priv_diff = set(new_priv[db_table]) - set(curr_priv[db_table])
|
||||
else:
|
||||
priv_diff = set(new_priv[db_table]) ^ set(curr_priv[db_table])
|
||||
|
||||
if len(priv_diff) > 0:
|
||||
msg = "Privileges updated"
|
||||
if module.check_mode:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue