From 7f90fde5b3a1744c7fe5700dc4e754f6d109118c Mon Sep 17 00:00:00 2001 From: Andrew Klychkov Date: Tue, 3 Mar 2020 04:22:35 +0300 Subject: [PATCH] Bugfix of 65525: proxysql in check_config TypeError: tuple indices must be integers, not str (#66850) (#67334) (cherry picked from commit a86524b2bb84a254f92a7351d95af8c3d83605a8) --- .../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 675fa536085..59ef6444b34 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 604867b2467..ac6c2cec359 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)