From dbf9a65c05514ce16a96c19633ffc96463882fa2 Mon Sep 17 00:00:00 2001 From: Will Thames Date: Wed, 9 Aug 2017 02:59:51 +1000 Subject: [PATCH] Improve error messages when MySQLdb is not installed (#27871) The python package is called MySQL-python in pypi, and reporting this rather than mysqldb makes resolving the problem far easier. --- lib/ansible/modules/database/mysql/mysql_db.py | 2 +- lib/ansible/modules/database/mysql/mysql_replication.py | 2 +- lib/ansible/modules/database/mysql/mysql_user.py | 2 +- lib/ansible/modules/database/mysql/mysql_variables.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ansible/modules/database/mysql/mysql_db.py b/lib/ansible/modules/database/mysql/mysql_db.py index 947d8c8edac..40ba37e8c16 100644 --- a/lib/ansible/modules/database/mysql/mysql_db.py +++ b/lib/ansible/modules/database/mysql/mysql_db.py @@ -276,7 +276,7 @@ def main(): ) if not mysqldb_found: - module.fail_json(msg="the python mysqldb module is required") + module.fail_json(msg="The MySQL-python module is required.") db = module.params["name"] encoding = module.params["encoding"] diff --git a/lib/ansible/modules/database/mysql/mysql_replication.py b/lib/ansible/modules/database/mysql/mysql_replication.py index 2baf14918b8..ca268bb937b 100644 --- a/lib/ansible/modules/database/mysql/mysql_replication.py +++ b/lib/ansible/modules/database/mysql/mysql_replication.py @@ -243,7 +243,7 @@ def main(): config_file = module.params['config_file'] if not mysqldb_found: - module.fail_json(msg="the python mysqldb module is required") + module.fail_json(msg="The MySQL-python module is required.") else: warnings.filterwarnings('error', category=MySQLdb.Warning) diff --git a/lib/ansible/modules/database/mysql/mysql_user.py b/lib/ansible/modules/database/mysql/mysql_user.py index c9f69b0b3e4..b7803491a3d 100644 --- a/lib/ansible/modules/database/mysql/mysql_user.py +++ b/lib/ansible/modules/database/mysql/mysql_user.py @@ -591,7 +591,7 @@ def main(): sql_log_bin = module.params["sql_log_bin"] if not mysqldb_found: - module.fail_json(msg="the python mysqldb module is required") + module.fail_json(msg="The MySQL-python module is required.") cursor = None try: diff --git a/lib/ansible/modules/database/mysql/mysql_variables.py b/lib/ansible/modules/database/mysql/mysql_variables.py index 190fe008006..b22ee2a2739 100644 --- a/lib/ansible/modules/database/mysql/mysql_variables.py +++ b/lib/ansible/modules/database/mysql/mysql_variables.py @@ -149,7 +149,7 @@ def main(): if match('^[0-9a-z_]+$', mysqlvar) is None: module.fail_json(msg="invalid variable name \"%s\"" % mysqlvar) if not mysqldb_found: - module.fail_json(msg="the python mysqldb module is required") + module.fail_json(msg="The MySQL-python module is required.") else: warnings.filterwarnings('error', category=MySQLdb.Warning)