Skip to content

Commit

Permalink
Improve error messages when MySQLdb is not installed (ansible#27871)
Browse files Browse the repository at this point in the history
The python package is called MySQL-python in pypi, and
reporting this rather than mysqldb makes resolving the
problem far easier.
  • Loading branch information
willthames authored and ryansb committed Aug 8, 2017
1 parent babec35 commit dbf9a65
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/ansible/modules/database/mysql/mysql_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
2 changes: 1 addition & 1 deletion lib/ansible/modules/database/mysql/mysql_replication.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion lib/ansible/modules/database/mysql/mysql_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion lib/ansible/modules/database/mysql/mysql_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit dbf9a65

Please sign in to comment.