mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-04-06 18:50:31 -07:00
Debug error "0"
This debug output this: [ {'Grants for root@localhost': \"GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION\"}, {'Grants for root@localhost': \"GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION\"} ], [ {'Grants for mysql.session@localhost': \"GRANT SUPER ON *.* TO 'mysql.session'@'localhost'\"}, {'Grants for mysql.session@localhost': \"GRANT SELECT ON `performance_schema`.* TO 'mysql.session'@'localhost'\"}, {'Grants for mysql.session@localhost': \"GRANT SELECT ON `mysql`.`user` TO 'mysql.session'@'localhost'\"} ], [ {'Grants for mysql.sys@localhost': \"GRANT USAGE ON *.* TO 'mysql.sys'@'localhost'\"}, {'Grants for mysql.sys@localhost': \"GRANT TRIGGER ON `sys`.* TO 'mysql.sys'@'localhost'\"}, {'Grants for mysql.sys@localhost': \"GRANT SELECT ON `sys`.`sys_config` TO 'mysql.sys'@'localhost'\"} ], [ {'Grants for root@%': \"GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION\"} ] I think something is wrong in the lambda and when grants art on ''@''.
This commit is contained in:
parent
d7beeec410
commit
31a5eb8739
1 changed files with 7 additions and 4 deletions
|
@ -107,13 +107,16 @@ def get_tls_requires(cursor, user, host):
|
|||
def get_grants(module, cursor, user, host):
|
||||
cursor.execute("SHOW GRANTS FOR %s@%s", (user, host))
|
||||
try:
|
||||
grants_line = list(filter(lambda x: "ON *.*" in x[0], cursor.fetchall()))[0]
|
||||
c = cursor.fetchall()
|
||||
# grants_line = list(filter(lambda x: "ON *.*" in x[0], cursor.fetchall()))[0]
|
||||
module.warn("%s" % c)
|
||||
except Exception as e:
|
||||
module.fail_json(msg="Error %s" % e)
|
||||
|
||||
pattern = r"(?<=\bGRANT\b)(.*?)(?=(?:\bON\b))"
|
||||
grants = re.search(pattern, grants_line[0]).group().strip()
|
||||
return grants.split(", ")
|
||||
# pattern = r"(?<=\bGRANT\b)(.*?)(?=(?:\bON\b))"
|
||||
# grants = re.search(pattern, grants_line[0]).group().strip()
|
||||
# return grants.split(", ")
|
||||
return "test"
|
||||
|
||||
|
||||
def get_existing_authentication(cursor, user):
|
||||
|
|
Loading…
Add table
Reference in a new issue