mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-08-02 04:04:26 -07:00
Revise DROP USER/ROLE commands with more specific version numbers to constrain IF EXISTS usage.
This commit is contained in:
parent
02c9cc1fb2
commit
a268f5d28a
3 changed files with 3 additions and 3 deletions
|
@ -368,7 +368,7 @@ def user_delete(cursor, user, host, host_all, check_mode):
|
|||
hostnames = [host]
|
||||
|
||||
for hostname in hostnames:
|
||||
cursor.execute("DROP USER /*!50700 IF EXISTS */ /*M!100100 IF EXISTS */ %s@%s", (user, hostname))
|
||||
cursor.execute("DROP USER /*!50708 IF EXISTS */ /*M!100103 IF EXISTS */ %s@%s", (user, hostname))
|
||||
|
||||
return True
|
||||
|
||||
|
|
|
@ -338,7 +338,7 @@ def db_delete(cursor, db):
|
|||
if not db:
|
||||
return False
|
||||
for each_db in db:
|
||||
query = "DROP DATABASE %s" % mysql_quote_identifier(each_db, 'database')
|
||||
query = "DROP DATABASE /*!50700 IF EXISTS */ /*M!100100 IF EXISTS */ %s" % mysql_quote_identifier(each_db, 'database')
|
||||
executed_commands.append(query)
|
||||
cursor.execute(query)
|
||||
return True
|
||||
|
|
|
@ -741,7 +741,7 @@ class Role():
|
|||
if check_mode and self.exists:
|
||||
return True
|
||||
|
||||
self.cursor.execute('DROP ROLE /*!50700 IF EXISTS */ /*M!100100 IF EXISTS */ %s', (self.name,))
|
||||
self.cursor.execute('/*M!100005 DROP ROLE */ /*M!100103 IF EXISTS */ /*M!100005 %s */', (self.name,))
|
||||
return True
|
||||
|
||||
def update_members(self, users, check_mode=False, append_members=False,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue