mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-04-20 09:21:25 -07:00
add a get_server_type module_utils method to detect MySQL vs MariaDB
This commit is contained in:
parent
1e24343375
commit
089e1c3fb1
3 changed files with 16 additions and 6 deletions
|
@ -305,7 +305,8 @@ from ansible_collections.community.mysql.plugins.module_utils.mysql import (
|
|||
mysql_connect,
|
||||
mysql_driver,
|
||||
mysql_driver_fail_msg,
|
||||
mysql_common_argument_spec
|
||||
mysql_common_argument_spec,
|
||||
get_server_type
|
||||
)
|
||||
from ansible_collections.community.mysql.plugins.module_utils.user import (
|
||||
convert_priv_dict_to_str,
|
||||
|
@ -407,9 +408,7 @@ class DbServer():
|
|||
Returns:
|
||||
library: Depending on a server type (MySQL or MariaDB).
|
||||
"""
|
||||
self.cursor.execute("SELECT VERSION()")
|
||||
|
||||
if 'mariadb' in self.cursor.fetchone()[0].lower():
|
||||
if get_server_type(cursor) == 'mariadb':
|
||||
import ansible_collections.community.mysql.plugins.module_utils.implementations.mariadb.role as role_impl
|
||||
else:
|
||||
import ansible_collections.community.mysql.plugins.module_utils.implementations.mysql.role as role_impl
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue