add a get_server_type module_utils method to detect MySQL vs MariaDB

This commit is contained in:
Laurent Indermuehle 2023-09-14 15:41:42 +02:00
parent 1e24343375
commit 089e1c3fb1
No known key found for this signature in database
GPG key ID: 93FA944C9F34DD09
3 changed files with 16 additions and 6 deletions

View file

@ -16,6 +16,7 @@ from ansible.module_utils.six import iteritems
from ansible_collections.community.mysql.plugins.module_utils.mysql import (
mysql_driver,
get_server_type,
)
@ -883,8 +884,8 @@ def limit_resources(module, cursor, user, host, resource_limits, check_mode):
def get_impl(cursor):
global impl
cursor.execute("SELECT VERSION()")
if 'mariadb' in cursor.fetchone()[0].lower():
if get_server_type(cursor) == 'mariadb':
from ansible_collections.community.mysql.plugins.module_utils.implementations.mariadb import user as mariauser
impl = mariauser
else: