Merge pull request #1222 from grypyrg/devel

mysql_replication: including error number and code
This commit is contained in:
Toshio Kuratomi 2015-11-11 11:21:05 -08:00
commit 16b1e39c97

View file

@ -337,7 +337,8 @@ def main():
else: else:
db_connection = MySQLdb.connect(host=module.params["login_host"], port=module.params["login_port"], user=login_user, passwd=login_password) db_connection = MySQLdb.connect(host=module.params["login_host"], port=module.params["login_port"], user=login_user, passwd=login_password)
except Exception, e: except Exception, e:
module.fail_json(msg="unable to connect to database, check login_user and login_password are correct or ~/.my.cnf has the credentials") errno, errstr = e.args
module.fail_json(msg="unable to connect to database, check login_user and login_password are correct or ~/.my.cnf has the credentials (%s: %s)" % (errno, errstr) )
try: try:
cursor = db_connection.cursor(cursorclass=MySQLdb.cursors.DictCursor) cursor = db_connection.cursor(cursorclass=MySQLdb.cursors.DictCursor)
except Exception, e: except Exception, e: