mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-04-08 19:50:31 -07:00
add filter to return an auth key when not empty
This commit is contained in:
parent
fcb2d49b24
commit
5dd0321607
1 changed files with 4 additions and 4 deletions
|
@ -554,18 +554,15 @@ class MySQL_Info(object):
|
||||||
|
|
||||||
resource_limits = get_resource_limits(self.module, self.cursor, user, host)
|
resource_limits = get_resource_limits(self.module, self.cursor, user, host)
|
||||||
|
|
||||||
authentications = get_existing_authentication(self.cursor, user, host)
|
|
||||||
|
|
||||||
copy_ressource_limits = dict.copy(resource_limits)
|
copy_ressource_limits = dict.copy(resource_limits)
|
||||||
output_dict = {
|
output_dict = {
|
||||||
'user': user,
|
'user': user,
|
||||||
'host': host,
|
'host': host,
|
||||||
'privs': '/'.join(priv_string),
|
'privs': '/'.join(priv_string),
|
||||||
'resource_limits': copy_ressource_limits,
|
'resource_limits': copy_ressource_limits,
|
||||||
'authentications': authentications
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Prevent returning a resource limit if there is no value
|
# Prevent returning a resource limit if empty
|
||||||
if resource_limits:
|
if resource_limits:
|
||||||
for key, value in resource_limits.items():
|
for key, value in resource_limits.items():
|
||||||
if value == 0:
|
if value == 0:
|
||||||
|
@ -573,6 +570,9 @@ class MySQL_Info(object):
|
||||||
if len(output_dict['resource_limits']) == 0:
|
if len(output_dict['resource_limits']) == 0:
|
||||||
del output_dict['resource_limits']
|
del output_dict['resource_limits']
|
||||||
|
|
||||||
|
authentications = get_existing_authentication(self.cursor, user, host)
|
||||||
|
output_dict.update(authentications)
|
||||||
|
|
||||||
output.append(output_dict)
|
output.append(output_dict)
|
||||||
|
|
||||||
self.info['users_privs'] = output
|
self.info['users_privs'] = output
|
||||||
|
|
Loading…
Add table
Reference in a new issue