From 605a5a5b5322c4335200ec3f4ae538e80494c8fc Mon Sep 17 00:00:00 2001 From: Bruce Pennypacker Date: Thu, 8 Jan 2015 21:41:15 +0000 Subject: [PATCH] requested changes --- lib/ansible/modules/database/mysql/mysql_user.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/lib/ansible/modules/database/mysql/mysql_user.py b/lib/ansible/modules/database/mysql/mysql_user.py index bc7132df70f..1ca5372c25f 100644 --- a/lib/ansible/modules/database/mysql/mysql_user.py +++ b/lib/ansible/modules/database/mysql/mysql_user.py @@ -317,10 +317,7 @@ def privileges_revoke(cursor, user,host,db_table,grant_option): query = ["REVOKE ALL PRIVILEGES ON %s" % mysql_quote_identifier(db_table, 'table')] query.append("FROM %s@%s") query = ' '.join(query) - try: - cursor.execute(query, (user, host)) - except Exception, e: - raise Exception("%s. Query=\"%s\"" % (str(e), query % (user, host))) + cursor.execute(query, (user, host)) def privileges_grant(cursor, user,host,db_table,priv): # Escape '%' since mysql db.execute uses a format string and the @@ -330,16 +327,11 @@ def privileges_grant(cursor, user,host,db_table,priv): query = ["GRANT %s ON %s" % (priv_string, mysql_quote_identifier(db_table, 'table'))] query.append("TO %s@%s") if 'GRANT' in priv: - query.append(" WITH GRANT OPTION") + query.append("WITH GRANT OPTION") if 'REQUIRESSL' in priv: - query.append(" REQUIRE SSL") + query.append("REQUIRE SSL") query = ' '.join(query) - try: - cursor.execute(query, (user, host)) - except Exception, e: - raise Exception("%s. Query=\"%s\"" % (str(e), query % (user, host))) - - + cursor.execute(query, (user, host)) def strip_quotes(s): """ Remove surrounding single or double quotes