mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-04-09 04:00:32 -07:00
fix case where a failed fetchone() still return a dict for primary
This commit is contained in:
parent
267e039342
commit
35599a7176
1 changed files with 6 additions and 4 deletions
|
@ -550,11 +550,13 @@ def main():
|
|||
|
||||
if mode == 'getprimary':
|
||||
status = get_primary_status(cursor)
|
||||
if not isinstance(status, dict):
|
||||
status = dict(Is_Primary=False,
|
||||
msg="Server is not configured as mysql primary")
|
||||
else:
|
||||
if status and "File" in status and "Position" in status:
|
||||
status['Is_Primary'] = True
|
||||
else:
|
||||
status = dict(
|
||||
Is_Primary=False,
|
||||
msg="Server is not configured as mysql primary. "
|
||||
"Meaning: Binary logs are disabled")
|
||||
|
||||
module.exit_json(queries=executed_queries, **status)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue