mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
if user is empty, it is not converted to tuple when using host_all (#3038)
This commit is contained in:
parent
aa67bb43fe
commit
ed246a328f
1 changed files with 3 additions and 3 deletions
|
@ -214,7 +214,7 @@ def get_mode(cursor):
|
|||
|
||||
def user_exists(cursor, user, host, host_all):
|
||||
if host_all:
|
||||
cursor.execute("SELECT count(*) FROM user WHERE user = %s", user)
|
||||
cursor.execute("SELECT count(*) FROM user WHERE user = %s", ([user]))
|
||||
else:
|
||||
cursor.execute("SELECT count(*) FROM user WHERE user = %s AND host = %s", (user,host))
|
||||
|
||||
|
@ -259,7 +259,7 @@ def user_mod(cursor, user, host, host_all, password, encrypted, new_priv, append
|
|||
# to simplify code, if we have a specific host and no host_all, we create
|
||||
# a list with just host and loop over that
|
||||
if host_all:
|
||||
hostnames = user_get_hostnames(cursor, user)
|
||||
hostnames = user_get_hostnames(cursor, [user])
|
||||
else:
|
||||
hostnames = [host]
|
||||
|
||||
|
@ -349,7 +349,7 @@ def user_delete(cursor, user, host, host_all, check_mode):
|
|||
return True
|
||||
|
||||
if host_all:
|
||||
hostnames = user_get_hostnames(cursor, user)
|
||||
hostnames = user_get_hostnames(cursor, [user])
|
||||
|
||||
for hostname in hostnames:
|
||||
cursor.execute("DROP USER %s@%s", (user, hostname))
|
||||
|
|
Loading…
Reference in a new issue