summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Runge <timorunge@users.noreply.github.com>2019-03-08 09:21:56 +0100
committerToshio Kuratomi <a.badger@gmail.com>2019-03-11 12:52:49 -0700
commita32e8c42b94b8d4f13e690885577499a95afd986 (patch)
tree378560c160ee2bf2c6cb1cc43acbc075e620cb54
parent7e83675227d2d49ea4304b626c3e698566b1e20e (diff)
downloadansible-a32e8c42b94b8d4f13e690885577499a95afd986.tar.gz
Fix for "AttributeError: 'module' object has no attribute 'cursors'" (#49191) (#53445)
* Fix for "AttributeError: 'module' object has no attribute 'cursors'" (#49191) (#1) * Fix for "AttributeError: 'module' object has no attribute 'cursors'" (#49191) * Adding changelog fragment for issue #49191 and the following PR. * Update lib/ansible/module_utils/mysql.py Co-Authored-By: timorunge <timorunge@users.noreply.github.com> (cherry picked from commit b45b5994332a327a5aca912b583735f0abb23dec)
-rw-r--r--changelogs/fragments/49191-module_utils_mysql-unexpected-keyword-argument-cursorclass.yml2
-rw-r--r--lib/ansible/module_utils/mysql.py1
2 files changed, 3 insertions, 0 deletions
diff --git a/changelogs/fragments/49191-module_utils_mysql-unexpected-keyword-argument-cursorclass.yml b/changelogs/fragments/49191-module_utils_mysql-unexpected-keyword-argument-cursorclass.yml
new file mode 100644
index 0000000000..01139d4f39
--- /dev/null
+++ b/changelogs/fragments/49191-module_utils_mysql-unexpected-keyword-argument-cursorclass.yml
@@ -0,0 +1,2 @@
+bugfixes:
+- mysql - MySQLdb doesn't import the cursors module for its own purposes so it has to be imported in MySQL module utilities before it can be used in dependent modules like the proxysql module family.
diff --git a/lib/ansible/module_utils/mysql.py b/lib/ansible/module_utils/mysql.py
index 8237efc10d..fab1bb27bb 100644
--- a/lib/ansible/module_utils/mysql.py
+++ b/lib/ansible/module_utils/mysql.py
@@ -35,6 +35,7 @@ try:
except ImportError:
try:
import MySQLdb as mysql_driver
+ import MySQLdb.cursors
_mysql_cursor_param = 'cursorclass'
except ImportError:
mysql_driver = None