Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
francescsanjuanmrf committed Aug 28, 2024
1 parent b9ebf51 commit 2e3c9ab
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions plugins/module_utils/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,9 +393,9 @@ def user_mod(cursor, user, host, host_all, password, encrypted,
update = True

if update:
if plugin_hash_string and not module.check_mode:
if plugin_hash_string:
query_with_args = "ALTER USER %s@%s IDENTIFIED WITH %s AS %s", (user, host, plugin, plugin_hash_string)
elif plugin_auth_string and not module.check_mode:
elif plugin_auth_string:
# Mysql and MariaDB differ in naming pam plugin and syntax to set it
if plugin in ('pam', 'ed25519'):
query_with_args = "ALTER USER %s@%s IDENTIFIED WITH %s USING %s", (user, host, plugin, plugin_auth_string)
Expand All @@ -407,7 +407,7 @@ def user_mod(cursor, user, host, host_all, password, encrypted,
query_with_args = ("ALTER USER %s@%s IDENTIFIED WITH %s AS 0x" + generated_hash_string), (user, host, plugin)
else:
query_with_args = "ALTER USER %s@%s IDENTIFIED WITH %s BY %s", (user, host, plugin, plugin_auth_string)
elif not module.check_mode:
else:
query_with_args = "ALTER USER %s@%s IDENTIFIED WITH %s", (user, host, plugin)

if not module.check_mode:
Expand Down

0 comments on commit 2e3c9ab

Please sign in to comment.