Cut support of Proxy privileges because it causes too many issues

This commit is contained in:
Laurent Indermuehle 2023-09-21 18:07:07 +02:00
parent eee4225ec4
commit 40f47f6828
No known key found for this signature in database
GPG key ID: 93FA944C9F34DD09

View file

@ -218,7 +218,7 @@ users_privs:
description: description:
Information about users accounts. The output can be used as an input of the Information about users accounts. The output can be used as an input of the
mysql_user plugin. Useful when migrating accounts to a new server or to mysql_user plugin. Useful when migrating accounts to a new server or to
create an inventory. create an inventory. Does not support proxy privileges.
returned: if not excluded by filter returned: if not excluded by filter
type: dict type: dict
sample: sample:
@ -570,18 +570,16 @@ class MySQL_Info(object):
priv_string = list() priv_string = list()
for db_table, priv in user_priv.items(): for db_table, priv in user_priv.items():
# privileges_get returns "'''@''': 'PROXY,GRANT'". The % is missing # Proxy privileges are hard to work with because of different quotes or
# and there is too many quotes. So we rewrite this. Also because we # backticks like ''@'', ''@'%' or even ``@``. In addition, MySQL will
# wrap the db_table between single quotes, I use backticks to # forbid you to grant a proxy privileges through TCP.
# indicate an empty string.
# #
# TODO: when dropping support of ansible-core 2.12, change: # TODO: when dropping support of ansible-core 2.12, change:
# set(['PROXY', 'GRANT']) # set(['PROXY', 'GRANT'])
# into: # into:
# {'PROXY', 'GRANT'} # {'PROXY', 'GRANT'}
# This is because the Sanity test for 2.12 uses Python 2.6!!! # This is because the Sanity test for 2.12 uses Python 2.6!!!
if set(priv) == set(['PROXY', 'GRANT']) and user == 'root': if set(priv) == set(['PROXY', 'GRANT']) or set(priv) == set(['PROXY']):
priv_string.append('``@`%`:PROXY,GRANT')
continue continue
unquote_db_table = db_table.replace('`', '').replace("'", '') unquote_db_table = db_table.replace('`', '').replace("'", '')