mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-04-24 19:31:30 -07:00
Add IF EXISTS clause to DROP USER statement (#309)
This commit is contained in:
parent
b0de252ce2
commit
59d411ac82
2 changed files with 6 additions and 1 deletions
|
@ -704,7 +704,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