From a86524b2bb84a254f92a7351d95af8c3d83605a8 Mon Sep 17 00:00:00 2001 From: Andrew Klychkov Date: Tue, 11 Feb 2020 18:53:42 +0300 Subject: [PATCH] Bugfix of 65525: proxysql in check_config TypeError: tuple indices must be integers, not str (#66850) --- .../modules/database/proxysql/proxysql_backend_servers.py | 4 ++++ .../modules/database/proxysql/proxysql_global_variables.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/lib/ansible/modules/database/proxysql/proxysql_backend_servers.py b/lib/ansible/modules/database/proxysql/proxysql_backend_servers.py index 2870f5c0715..0c730b50eff 100644 --- a/lib/ansible/modules/database/proxysql/proxysql_backend_servers.py +++ b/lib/ansible/modules/database/proxysql/proxysql_backend_servers.py @@ -259,6 +259,10 @@ class ProxySQLServer(object): cursor.execute(query_string, query_data) check_count = cursor.fetchone() + + if isinstance(check_count, tuple): + return int(check_count[0]) > 0 + return (int(check_count['host_count']) > 0) def get_server_config(self, cursor): diff --git a/lib/ansible/modules/database/proxysql/proxysql_global_variables.py b/lib/ansible/modules/database/proxysql/proxysql_global_variables.py index 3a13580081e..ddd7447fa6f 100644 --- a/lib/ansible/modules/database/proxysql/proxysql_global_variables.py +++ b/lib/ansible/modules/database/proxysql/proxysql_global_variables.py @@ -119,6 +119,10 @@ def check_config(variable, value, cursor): cursor.execute(query_string, query_data) check_count = cursor.fetchone() + + if isinstance(check_count, tuple): + return int(check_count[0]) > 0 + return (int(check_count['variable_count']) > 0)