mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-08-20 04:51:44 -07:00
Use stdlib version comparison
This commit is contained in:
parent
14380349db
commit
9ad771bdd6
1 changed files with 2 additions and 2 deletions
|
@ -10,7 +10,7 @@
|
||||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||||
|
|
||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
from packaging import version
|
from distutils.version import LooseVersion
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
@ -92,7 +92,7 @@ def mysql_connect(module, login_user=None, login_password=None, config_file='',
|
||||||
config['connect_timeout'] = connect_timeout
|
config['connect_timeout'] = connect_timeout
|
||||||
if check_hostname is not None:
|
if check_hostname is not None:
|
||||||
if mysql_driver.__name__ == "pymysql":
|
if mysql_driver.__name__ == "pymysql":
|
||||||
if version.parse(mysql_driver.__version__) >= "0.7.11":
|
if LooseVersion(mysql_driver.__version__) >= LooseVersion("0.7.11"):
|
||||||
config['ssl']['check_hostname'] = check_hostname
|
config['ssl']['check_hostname'] = check_hostname
|
||||||
else:
|
else:
|
||||||
module.fail_json(msg='To use check_hostname, pymysql >= 0.7.11 is required on the target host')
|
module.fail_json(msg='To use check_hostname, pymysql >= 0.7.11 is required on the target host')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue