mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-04-09 04:00:32 -07:00
Add check_mode support.
Signed-off-by: E.S. Rosenberg a.k.a. Keeper of the Keys <es.rosenberg+github@gmail.com>
This commit is contained in:
parent
e95c3dab6b
commit
3984380acb
1 changed files with 7 additions and 6 deletions
|
@ -553,12 +553,13 @@ def user_mod(cursor, user, host, host_all, password, encrypted,
|
|||
final_attributes = attributes_get(cursor, user, host)
|
||||
|
||||
if user_is_locked(cursor, user, host) != locked:
|
||||
if locked:
|
||||
cursor.execute("ALTER USER %s@%s ACCOUNT LOCK", (user, host))
|
||||
msg = 'User locked'
|
||||
else:
|
||||
cursor.execute("ALTER USER %s@%s ACCOUNT UNLOCK", (user, host))
|
||||
msg = 'User unlocked'
|
||||
if not module.check_mode:
|
||||
if locked:
|
||||
cursor.execute("ALTER USER %s@%s ACCOUNT LOCK", (user, host))
|
||||
msg = 'User locked'
|
||||
else:
|
||||
cursor.execute("ALTER USER %s@%s ACCOUNT UNLOCK", (user, host))
|
||||
msg = 'User unlocked'
|
||||
changed = True
|
||||
|
||||
if role:
|
||||
|
|
Loading…
Add table
Reference in a new issue