mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-08-03 12:44:25 -07:00
Adding params in exception output and check exception message with is search instead of find expression (#465)
This commit is contained in:
parent
222eb60371
commit
70efd0f43c
2 changed files with 6 additions and 3 deletions
|
@ -725,7 +725,8 @@ def privileges_grant(cursor, user, host, db_table, priv, tls_requires, maria_rol
|
|||
try:
|
||||
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 , query: %s , exception: %s." % (priv_string, query, str(e)))
|
||||
raise InvalidPrivsError("Error granting privileges, invalid priv string: %s , params: %s, query: %s ,"
|
||||
" exception: %s." % (priv_string, str(params), query, str(e)))
|
||||
|
||||
|
||||
def convert_priv_dict_to_str(priv):
|
||||
|
|
|
@ -40,5 +40,7 @@
|
|||
assert:
|
||||
that:
|
||||
- result is failed
|
||||
- result.msg.find('exception') != -1
|
||||
fail_msg: "Error granting privileges, invalid priv string: SELECT , query: GRANT SELECT ON *.`data` TO %s@%s , exception: (1064, \"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`data` TO 'db_user2'@'localhost'' at line 1\")."
|
||||
- result.msg is search('invalid priv string')
|
||||
- result.msg is search('params')
|
||||
- result.msg is search('query')
|
||||
- result.msg is search('exception')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue