mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-04-18 08:21:26 -07:00
Removing is_mariadb and is_mysql functions
This commit is contained in:
parent
93e42bc8f9
commit
6ac515bfa5
3 changed files with 2 additions and 33 deletions
|
@ -214,20 +214,6 @@ def get_server_implementation(cursor):
|
||||||
return "mysql"
|
return "mysql"
|
||||||
|
|
||||||
|
|
||||||
def is_mariadb(implementation):
|
|
||||||
if implementation == "mariadb":
|
|
||||||
return True
|
|
||||||
else:
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
def is_mysql(implementation):
|
|
||||||
if implementation == "mysql":
|
|
||||||
return True
|
|
||||||
else:
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
def set_session_vars(module, cursor, session_vars):
|
def set_session_vars(module, cursor, session_vars):
|
||||||
"""Set session vars."""
|
"""Set session vars."""
|
||||||
for var, value in session_vars.items():
|
for var, value in session_vars.items():
|
||||||
|
|
|
@ -294,7 +294,6 @@ from ansible_collections.community.mysql.plugins.module_utils.mysql import (
|
||||||
get_connector_name,
|
get_connector_name,
|
||||||
get_connector_version,
|
get_connector_version,
|
||||||
get_server_implementation,
|
get_server_implementation,
|
||||||
is_mariadb,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
from ansible_collections.community.mysql.plugins.module_utils.user import (
|
from ansible_collections.community.mysql.plugins.module_utils.user import (
|
||||||
|
@ -501,7 +500,7 @@ class MySQL_Info(object):
|
||||||
|
|
||||||
def __get_slave_status(self):
|
def __get_slave_status(self):
|
||||||
"""Get slave status if the instance is a slave."""
|
"""Get slave status if the instance is a slave."""
|
||||||
if is_mariadb(self.server_implementation):
|
if self.server_implementation == "mariadb":
|
||||||
res = self.__exec_sql('SHOW ALL SLAVES STATUS')
|
res = self.__exec_sql('SHOW ALL SLAVES STATUS')
|
||||||
else:
|
else:
|
||||||
res = self.__exec_sql('SHOW SLAVE STATUS')
|
res = self.__exec_sql('SHOW SLAVE STATUS')
|
||||||
|
|
|
@ -4,7 +4,7 @@ __metaclass__ = type
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from ansible_collections.community.mysql.plugins.module_utils.mysql import get_server_version, get_server_implementation, is_mariadb, is_mysql
|
from ansible_collections.community.mysql.plugins.module_utils.mysql import get_server_version, get_server_implementation
|
||||||
from ..utils import dummy_cursor_class
|
from ..utils import dummy_cursor_class
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,19 +41,3 @@ def test_get_server_implamentation(cursor_return_version, cursor_return_type, se
|
||||||
cursor = dummy_cursor_class(cursor_return_version, cursor_return_type)
|
cursor = dummy_cursor_class(cursor_return_version, cursor_return_type)
|
||||||
|
|
||||||
assert get_server_implementation(cursor) == server_implementation
|
assert get_server_implementation(cursor) == server_implementation
|
||||||
|
|
||||||
|
|
||||||
def test_is_mysql():
|
|
||||||
"""
|
|
||||||
Test that server is_mysql return expect results
|
|
||||||
"""
|
|
||||||
assert is_mysql("mysql") is True
|
|
||||||
assert is_mysql("mariadb") is False
|
|
||||||
|
|
||||||
|
|
||||||
def test_is_mariadb():
|
|
||||||
"""
|
|
||||||
Test that server is_mariadb return expect results
|
|
||||||
"""
|
|
||||||
assert is_mariadb("mariadb") is True
|
|
||||||
assert is_mariadb("mysql") is False
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue