mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-04-26 04:11:28 -07:00
* Add IF EXISTS clause to DROP USER statement
* Add a changelog fragment
* Fix exception
(cherry picked from commit 3a452faeb0
)
This commit is contained in:
parent
fecc9866e3
commit
66c340e951
2 changed files with 6 additions and 1 deletions
|
@ -419,7 +419,10 @@ def user_delete(cursor, user, host, host_all, check_mode):
|
|||
hostnames = [host]
|
||||
|
||||
for hostname in hostnames:
|
||||
cursor.execute("DROP USER %s@%s", (user, hostname))
|
||||
try:
|
||||
cursor.execute("DROP USER IF EXISTS %s@%s", (user, hostname))
|
||||
except Exception:
|
||||
cursor.execute("DROP USER %s@%s", (user, hostname))
|
||||
|
||||
return True
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue