From 5c2fe15dc0f3238b2357aeb8a96c55c296bef4c1 Mon Sep 17 00:00:00 2001 From: Laurent Indermuehle Date: Fri, 26 Apr 2024 17:01:18 +0200 Subject: [PATCH] Fix case where a failed fetchone() still return a dict --- plugins/modules/mysql_replication.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/modules/mysql_replication.py b/plugins/modules/mysql_replication.py index 934b479..39c16f0 100644 --- a/plugins/modules/mysql_replication.py +++ b/plugins/modules/mysql_replication.py @@ -560,10 +560,10 @@ def main(): elif mode == "getreplica": status = get_replica_status(cursor, connection_name, channel, replica_term) - if not isinstance(status, dict): - status = dict(Is_Replica=False, msg="Server is not configured as mysql replica") - else: + if status and "Slave_IO_Running" in status and "Slave_SQL_Running" in status: status['Is_Replica'] = True + else: + status = dict(Is_Replica=False, msg="Server is not configured as mysql replica") module.exit_json(queries=executed_queries, **status)