From 2f26a6681f30cbd83cab959f3126e9701deef5fd Mon Sep 17 00:00:00 2001 From: Jorge-Rodriguez Date: Tue, 17 Nov 2020 14:52:59 +0200 Subject: [PATCH] Add account locking warnings on user add --- plugins/modules/mysql_user.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/plugins/modules/mysql_user.py b/plugins/modules/mysql_user.py index 5115072..045467b 100644 --- a/plugins/modules/mysql_user.py +++ b/plugins/modules/mysql_user.py @@ -553,12 +553,16 @@ def get_grants(cursor, user, host): def user_add(cursor, user, host, host_all, password, encrypted, plugin, plugin_hash_string, plugin_auth_string, new_priv, - tls_requires, account_locking, check_mode): + tls_requires, account_locking, check_mode, module): # we cannot create users without a proper hostname if host_all: return False msg, locking = validate_account_locking(cursor, account_locking) + if msg: + module.warn(msg) + module.warn("Account locking settings are being ignored.") + if check_mode: return (True, msg) @@ -1219,8 +1223,8 @@ def main(): module.fail_json(msg="host_all parameter cannot be used when adding a user") try: changed = user_add(cursor, user, host, host_all, password, encrypted, - plugin, plugin_hash_string, plugin_auth_string, - priv, tls_requires, account_locking, module.check_mode) + plugin, plugin_hash_string, plugin_auth_string, priv, + tls_requires, account_locking, module.check_mode, module) if changed: msg = "User added"