Skip to content

Commit

Permalink
Fix user plugin changes in check mode (#596)
Browse files Browse the repository at this point in the history
* Fix user plugin changes in check mode

* Add auth plugin tests

* Undo local changes

* Improve task names

* Fix query

* Changes

* Add check

* Add check

* Add check

* Add one more check

* Add one more check

* Fix typo

* Change parameter

* Testing

* Remove tests

* Add tests

* Test first stteps

* Readd tests

* Test without check mode

* Test with check mode

* Test with check mode

* Testing

* Testing

* Add missing tests

* Changes for ansible-lint complaints

* Fix condition

* Update changelogs/fragments/596-fix-check-changes.yaml

Co-authored-by: Andrew Klychkov <[email protected]>

* refactor

* Add more tests

* Fix newpass var

* Remove extra test

---------

Co-authored-by: Andrew Klychkov <[email protected]>
  • Loading branch information
francescsanjuanmrf and Andersson007 authored Aug 30, 2024
1 parent 87be61c commit 0de9685
Show file tree
Hide file tree
Showing 4 changed files with 175 additions and 68 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/596-fix-check-changes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- mysql_user - module makes changes when is executed with ``plugin_auth_string`` parameter and check mode.
3 changes: 2 additions & 1 deletion plugins/module_utils/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,8 @@ def user_mod(cursor, user, host, host_all, password, encrypted,
else:
query_with_args = "ALTER USER %s@%s IDENTIFIED WITH %s", (user, host, plugin)

cursor.execute(*query_with_args)
if not module.check_mode:
cursor.execute(*query_with_args)
password_changed = True
changed = True

Expand Down
Loading

0 comments on commit 0de9685

Please sign in to comment.