mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-08-23 14:31:47 -07:00
fix
This commit is contained in:
parent
521443a671
commit
ade51d74a5
1 changed files with 11 additions and 9 deletions
|
@ -692,17 +692,19 @@ def privileges_revoke(cursor, user, host, db_table, priv, grant_option, maria_ro
|
||||||
query = ' '.join(query)
|
query = ' '.join(query)
|
||||||
cursor.execute(query, (user, host))
|
cursor.execute(query, (user, host))
|
||||||
priv_string = ",".join([p for p in priv if p not in ('GRANT', )])
|
priv_string = ",".join([p for p in priv if p not in ('GRANT', )])
|
||||||
query = ["REVOKE %s ON %s" % (priv_string, db_table)]
|
|
||||||
|
|
||||||
if not maria_role:
|
if priv_string != "":
|
||||||
query.append("FROM %s@%s")
|
query = ["REVOKE %s ON %s" % (priv_string, db_table)]
|
||||||
params = (user, host)
|
|
||||||
else:
|
|
||||||
query.append("FROM %s")
|
|
||||||
params = (user,)
|
|
||||||
|
|
||||||
query = ' '.join(query)
|
if not maria_role:
|
||||||
cursor.execute(query, params)
|
query.append("FROM %s@%s")
|
||||||
|
params = (user, host)
|
||||||
|
else:
|
||||||
|
query.append("FROM %s")
|
||||||
|
params = (user,)
|
||||||
|
|
||||||
|
query = ' '.join(query)
|
||||||
|
cursor.execute(query, params)
|
||||||
cursor.execute("FLUSH PRIVILEGES")
|
cursor.execute("FLUSH PRIVILEGES")
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue