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.
pull/20890/merge
Will Thames 7 years ago committed by Ryan Brown
parent babec35faa
commit dbf9a65c05

@ -276,7 +276,7 @@ def main():
) )
if not mysqldb_found: 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"] db = module.params["name"]
encoding = module.params["encoding"] encoding = module.params["encoding"]

@ -243,7 +243,7 @@ def main():
config_file = module.params['config_file'] config_file = module.params['config_file']
if not mysqldb_found: 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: else:
warnings.filterwarnings('error', category=MySQLdb.Warning) warnings.filterwarnings('error', category=MySQLdb.Warning)

@ -591,7 +591,7 @@ def main():
sql_log_bin = module.params["sql_log_bin"] sql_log_bin = module.params["sql_log_bin"]
if not mysqldb_found: 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 cursor = None
try: try:

@ -149,7 +149,7 @@ def main():
if match('^[0-9a-z_]+$', mysqlvar) is None: if match('^[0-9a-z_]+$', mysqlvar) is None:
module.fail_json(msg="invalid variable name \"%s\"" % mysqlvar) module.fail_json(msg="invalid variable name \"%s\"" % mysqlvar)
if not mysqldb_found: 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: else:
warnings.filterwarnings('error', category=MySQLdb.Warning) warnings.filterwarnings('error', category=MySQLdb.Warning)

Loading…
Cancel
Save