From 856753215fe5c3543f773bc11307e305353382a1 Mon Sep 17 00:00:00 2001 From: Matthieu Bourgain Date: Wed, 24 Apr 2024 10:37:24 +0200 Subject: [PATCH] revert else removing --- plugins/module_utils/user.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/module_utils/user.py b/plugins/module_utils/user.py index 0d8e6e8..80da47e 100644 --- a/plugins/module_utils/user.py +++ b/plugins/module_utils/user.py @@ -190,6 +190,8 @@ def user_add(cursor, user, host, host_all, password, encrypted, elif salt: if plugin in ['caching_sha2_password', 'sha256_password']: generated_hash_string = mysql_sha256_password_hash_hex(password=plugin_auth_string, salt=salt) + else: + module.fail_json(msg="salt not handled for %s authentication plugin" % plugin) query_with_args = ("CREATE USER %s@%s IDENTIFIED WITH %s AS 0x" + generated_hash_string), (user, host, plugin) else: query_with_args = "CREATE USER %s@%s IDENTIFIED WITH %s BY %s", (user, host, plugin, plugin_auth_string) @@ -373,6 +375,8 @@ def user_mod(cursor, user, host, host_all, password, encrypted, elif salt: if plugin in ['caching_sha2_password', 'sha256_password']: generated_hash_string = mysql_sha256_password_hash_hex(password=plugin_auth_string, salt=salt) + else: + module.fail_json(msg="salt not handled for %s authentication plugin" % plugin) 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)