Fix the collection to work with mysqlclient connector (#293)

* Integration tests: restrict exclusion mysqlclient + MariaDB only when testing the mysql_role module

* Fix

* Fix underlying issue

* Fix units

* Add changelog fragment
This commit is contained in:
Andrew Klychkov 2022-03-14 12:03:47 +03:00 committed by GitHub
parent 71a628f82d
commit f00f06df76
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 9 deletions

View file

@ -398,7 +398,7 @@ def privileges_get(cursor, user, host, maria_role=False):
if not maria_role:
cursor.execute("SHOW GRANTS FOR %s@%s", (user, host))
else:
cursor.execute("SHOW GRANTS FOR %s", (user))
cursor.execute("SHOW GRANTS FOR %s", (user,))
grants = cursor.fetchall()
def pick(x):
@ -618,7 +618,7 @@ def privileges_revoke(cursor, user, host, db_table, priv, grant_option, maria_ro
params = (user, host)
else:
query.append("FROM %s")
params = (user)
params = (user,)
query = ' '.join(query)
cursor.execute(query, params)
@ -644,6 +644,10 @@ def privileges_grant(cursor, user, host, db_table, priv, tls_requires, maria_rol
if 'GRANT' in priv:
query.append("WITH GRANT OPTION")
query = ' '.join(query)
if isinstance(params, str):
params = (params,)
try:
cursor.execute(query, params)
except (mysql_driver.ProgrammingError, mysql_driver.OperationalError, mysql_driver.InternalError) as e: