From 8fe42e74b643b024484878da355fde62351bf618 Mon Sep 17 00:00:00 2001 From: maximilian Date: Tue, 12 Aug 2025 08:32:53 +0200 Subject: [PATCH] Changed code layout as suggested by flake8 --- plugins/module_utils/user.py | 6 +++++- plugins/modules/mysql_user.py | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/module_utils/user.py b/plugins/module_utils/user.py index 8b1208f..b19a3b0 100644 --- a/plugins/module_utils/user.py +++ b/plugins/module_utils/user.py @@ -30,9 +30,11 @@ from ansible_collections.community.mysql.plugins.module_utils.implementations.my class InvalidPrivsError(Exception): pass + diff_current = {} diff_new = {} + def get_mode(cursor): cursor.execute('SELECT @@sql_mode') result = cursor.fetchone() @@ -634,7 +636,9 @@ def user_mod(cursor, user, host, host_all, password, encrypted, cursor.execute(*query_with_args) changed = True - return {'changed': changed, 'msg': msg, 'password_changed': password_changed, 'attributes': final_attributes, 'diff_current': diff_current, 'diff_new': diff_new} + return {'changed': changed, 'msg': msg, 'password_changed': password_changed, 'attributes': final_attributes, + 'diff_current': diff_current, 'diff_new': diff_new} + def user_delete(cursor, user, host, host_all, check_mode): diff_new['state'] = "absent" diff --git a/plugins/modules/mysql_user.py b/plugins/modules/mysql_user.py index b7adcbc..71adb87 100644 --- a/plugins/modules/mysql_user.py +++ b/plugins/modules/mysql_user.py @@ -650,7 +650,8 @@ def main(): else: changed = False msg = "User doesn't exist" - module.exit_json(changed=changed, diff={'before': diff_current, 'after': diff_new}, user=user, msg=msg, password_changed=password_changed, attributes=final_attributes) + module.exit_json(changed=changed, diff={'before': diff_current, 'after': diff_new}, user=user, msg=msg, + password_changed=password_changed, attributes=final_attributes) if __name__ == '__main__':