mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-08-31 10:21:47 -07:00
Fix
This commit is contained in:
parent
b80a17265f
commit
9dfd636208
2 changed files with 16 additions and 1 deletions
|
@ -22,6 +22,9 @@ options:
|
|||
description:
|
||||
- SQL query to run. Multiple queries can be passed using YAML list syntax.
|
||||
- Must be a string or YAML list containing strings.
|
||||
- Note that if you use the C(IF EXISTS/IF NOT EXIST) clauses in your query,
|
||||
the module will report that the state has been changed even if it has not
|
||||
when C(mysqlclient) connector is used.
|
||||
type: raw
|
||||
required: yes
|
||||
positional_args:
|
||||
|
@ -211,7 +214,8 @@ def main():
|
|||
except mysql_driver.Warning:
|
||||
# When something is run with IF NOT EXISTS
|
||||
# and there's "already exists" MySQL warning,
|
||||
# set the flag as True
|
||||
# set the flag as True.
|
||||
# PyMySQL throws the warning, mysqlclinet does NOT.
|
||||
already_exists = True
|
||||
|
||||
except Exception as e:
|
||||
|
|
|
@ -341,7 +341,18 @@
|
|||
# Issue https://github.com/ansible-collections/community.mysql/issues/268
|
||||
- assert:
|
||||
that:
|
||||
# PyMySQL driver throws a warning, so the following is correct
|
||||
- result is not changed
|
||||
when: connector.name.0 is search('pymysql')
|
||||
|
||||
# Issue https://github.com/ansible-collections/community.mysql/issues/268
|
||||
- assert:
|
||||
that:
|
||||
# mysqlclient driver throws nothing, so it's impossible to figure out
|
||||
# if the state was changed or not.
|
||||
# We assume that it was for DDL queryes by default in the code
|
||||
- result is changed
|
||||
when: connector.name.0 is search('mysqlclient')
|
||||
|
||||
- name: Drop db {{ test_db }}
|
||||
mysql_query:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue