Fix case where a failed fetchone() still return a dict

This commit is contained in:
Laurent Indermuehle 2024-04-26 17:01:18 +02:00
parent 47710cfb93
commit 5c2fe15dc0
No known key found for this signature in database
GPG key ID: 93FA944C9F34DD09

View file

@ -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)