mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-04-21 09:51:31 -07:00
Re-raise InvalidPrivsError when granting privileges
This commit is contained in:
parent
ce3f7065a9
commit
c8d93c796f
3 changed files with 6 additions and 3 deletions
|
@ -644,7 +644,10 @@ def privileges_grant(cursor, user, host, db_table, priv, tls_requires, maria_rol
|
||||||
if 'GRANT' in priv:
|
if 'GRANT' in priv:
|
||||||
query.append("WITH GRANT OPTION")
|
query.append("WITH GRANT OPTION")
|
||||||
query = ' '.join(query)
|
query = ' '.join(query)
|
||||||
|
try:
|
||||||
cursor.execute(query, params)
|
cursor.execute(query, params)
|
||||||
|
except (mysql_driver.ProgrammingError, mysql_driver.OperationalError, mysql_driver.InternalError) as e:
|
||||||
|
raise InvalidPrivsError("Error granting privileges, invalid priv string: %s" % priv_string) from e
|
||||||
|
|
||||||
|
|
||||||
def convert_priv_dict_to_str(priv):
|
def convert_priv_dict_to_str(priv):
|
||||||
|
|
|
@ -112,7 +112,7 @@
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- "result.changed == false"
|
- "result.changed == false"
|
||||||
- "'Illegal privilege' in result.msg or 'You have an error in your SQL syntax;' in result.msg"
|
- "'Error granting privileges' in result.msg"
|
||||||
when: enable_check_mode == 'no'
|
when: enable_check_mode == 'no'
|
||||||
|
|
||||||
##########
|
##########
|
||||||
|
|
|
@ -193,7 +193,7 @@
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- "result.changed == false"
|
- "result.changed == false"
|
||||||
- "'Illegal privilege' in result.msg or 'You have an error in your SQL syntax;' in result.msg"
|
- "'Error granting privileges' in result.msg"
|
||||||
|
|
||||||
- name: remove username
|
- name: remove username
|
||||||
mysql_user:
|
mysql_user:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue