Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mysql_user: prevent password getting set for existing users on on_cre… #342

Merged
2 changes: 2 additions & 0 deletions changelogs/fragments/334-mysql_user_fix_logic_on_oncreate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- "mysql_user - fix logic when ``update_password`` is set to ``on_create`` for users using ``plugin*`` arguments (https://github.com/ansible-collections/community.mysql/issues/334).". The ``on_create`` sets ``password`` to None for old mysql_native_authentication but not for authentiation methods which uses the ``plugin*`` arguments. This PR changes this so ``on_create`` also exchange ``plugin``, ``plugin_hash_string``, ``plugin_auth_string`` to None in the list of arguments to change
8 changes: 4 additions & 4 deletions plugins/modules/mysql_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
required: true
password:
description:
- Set the user's password.
- Set the user's password. Only for `mysql_native_password` authentication. For other authentication plugins see the combination of plugin, plugin_hash_string, plugin_auth_string.
hubiongithub marked this conversation as resolved.
Show resolved Hide resolved
type: str
encrypted:
description:
Expand Down Expand Up @@ -115,8 +115,8 @@
default: no
update_password:
description:
- C(always) will update passwords if they differ.
- C(on_create) will only set the password for newly created users.
- C(always) will update passwords if they differ. This affects password and the combinationi of plugin, plugin_hash_string, plugin_auth_string
hubiongithub marked this conversation as resolved.
Show resolved Hide resolved
- C(on_create) will only set the password or the combination of plugin, plugin_hash_string, plugin_auth_string for newly created users.
hubiongithub marked this conversation as resolved.
Show resolved Hide resolved
type: str
choices: [ always, on_create ]
default: always
Expand Down Expand Up @@ -456,7 +456,7 @@ def main():
priv, append_privs, subtract_privs, tls_requires, module)
else:
changed, msg = user_mod(cursor, user, host, host_all, None, encrypted,
plugin, plugin_hash_string, plugin_auth_string,
None, None, None,
priv, append_privs, subtract_privs, tls_requires, module)

except (SQLParseError, InvalidPrivsError, mysql_driver.Error) as e:
Expand Down