Skip to content

Commit

Permalink
fix connection arguments for MySQLdb <2.0 !=1.0 (#553)
Browse files Browse the repository at this point in the history
* fix connection arguments for MySQLdb <2.0 !=1.0

* add changelog fragment

---------

Co-authored-by: Felix Hamme <[email protected]>
  • Loading branch information
betanummeric and fhamme authored May 23, 2023
1 parent bff05ce commit b6ad472
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- mysql module utils - use the connection arguments ``db`` instead of ``database`` and ``passwd`` instead of ``password`` when running with MySQLdb < 2.0.0 (https://github.com/ansible-collections/community.mysql/pull/553).
2 changes: 1 addition & 1 deletion plugins/module_utils/mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def mysql_connect(module, login_user=None, login_password=None, config_file='',
db_connection = mysql_driver.connect(autocommit=autocommit, **config)
else:
# In case of MySQLdb driver
if mysql_driver.version_info[0] < 2 and mysql_driver.version_info[1] < 1:
if mysql_driver.version_info[0] < 2 or (mysql_driver.version_info[0] == 2 and mysql_driver.version_info[1] < 1):
# for MySQLdb < 2.1.0, use 'db' instead of 'database' and 'passwd' instead of 'password'
if 'database' in config:
config['db'] = config['database']
Expand Down

0 comments on commit b6ad472

Please sign in to comment.