|
5 | 5 | # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
6 | 6 |
|
7 | 7 | from __future__ import absolute_import, division, print_function
|
| 8 | + |
8 | 9 | __metaclass__ = type
|
9 | 10 |
|
10 | 11 | DOCUMENTATION = r'''
|
|
292 | 293 | mysql_driver_fail_msg,
|
293 | 294 | get_connector_name,
|
294 | 295 | get_connector_version,
|
| 296 | + get_server_implementation, |
295 | 297 | )
|
296 | 298 |
|
297 | 299 | from ansible_collections.community.mysql.plugins.module_utils.user import (
|
@@ -325,9 +327,10 @@ class MySQL_Info(object):
|
325 | 327 | 5. add info about the new subset with an example to RETURN block
|
326 | 328 | """
|
327 | 329 |
|
328 |
| - def __init__(self, module, cursor): |
| 330 | + def __init__(self, module, cursor, server_implementation): |
329 | 331 | self.module = module
|
330 | 332 | self.cursor = cursor
|
| 333 | + self.server_implementation = server_implementation |
331 | 334 | self.info = {
|
332 | 335 | 'version': {},
|
333 | 336 | 'databases': {},
|
@@ -497,7 +500,10 @@ def __get_master_status(self):
|
497 | 500 |
|
498 | 501 | def __get_slave_status(self):
|
499 | 502 | """Get slave status if the instance is a slave."""
|
500 |
| - res = self.__exec_sql('SHOW SLAVE STATUS') |
| 503 | + if self.server_implementation == "mariadb": |
| 504 | + res = self.__exec_sql('SHOW ALL SLAVES STATUS') |
| 505 | + else: |
| 506 | + res = self.__exec_sql('SHOW SLAVE STATUS') |
501 | 507 | if res:
|
502 | 508 | for line in res:
|
503 | 509 | host = line['Master_Host']
|
@@ -738,10 +744,12 @@ def main():
|
738 | 744 | 'Exception message: %s' % (connector_name, connector_version, config_file, to_native(e)))
|
739 | 745 | module.fail_json(msg)
|
740 | 746 |
|
| 747 | + server_implementation = get_server_implementation(cursor) |
| 748 | + |
741 | 749 | ###############################
|
742 | 750 | # Create object and do main job
|
743 | 751 |
|
744 |
| - mysql = MySQL_Info(module, cursor) |
| 752 | + mysql = MySQL_Info(module, cursor, server_implementation) |
745 | 753 |
|
746 | 754 | module.exit_json(changed=False,
|
747 | 755 | connector_name=connector_name,
|
|
0 commit comments