mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-04-08 19:50:31 -07:00
fix case when user as no other privileges than USAGE
This commit is contained in:
parent
122625c477
commit
ddd3812574
2 changed files with 8 additions and 3 deletions
|
@ -545,9 +545,6 @@ 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():
|
||||||
if db_table == '*.*' and priv == ['USAGE']:
|
|
||||||
continue
|
|
||||||
|
|
||||||
# privileges_get returns "'''@''': 'PROXY,GRANT'". The % is missing
|
# privileges_get returns "'''@''': 'PROXY,GRANT'". The % is missing
|
||||||
# and there is too many quotes. So we rewrite this. Also because we
|
# and there is too many quotes. So we rewrite this. Also because we
|
||||||
# wrap the db_table between single quotes, I use backticks to
|
# wrap the db_table between single quotes, I use backticks to
|
||||||
|
@ -565,6 +562,10 @@ class MySQL_Info(object):
|
||||||
unquote_db_table = db_table.replace('`', '').replace("'", '')
|
unquote_db_table = db_table.replace('`', '').replace("'", '')
|
||||||
priv_string.append('%s:%s' % (unquote_db_table, ','.join(priv)))
|
priv_string.append('%s:%s' % (unquote_db_table, ','.join(priv)))
|
||||||
|
|
||||||
|
# Only keep *.* USAGE if it's the only user privilege given
|
||||||
|
if len(priv_string) > 1 and '*.*:USAGE' in priv_string:
|
||||||
|
priv_string.remove('*.*:USAGE')
|
||||||
|
|
||||||
resource_limits = get_resource_limits(self.module, self.cursor, user, host)
|
resource_limits = get_resource_limits(self.module, self.cursor, user, host)
|
||||||
|
|
||||||
copy_ressource_limits = dict.copy(resource_limits)
|
copy_ressource_limits = dict.copy(resource_limits)
|
||||||
|
|
|
@ -75,6 +75,9 @@
|
||||||
privs:
|
privs:
|
||||||
'mysql.*': 'SELECT'
|
'mysql.*': 'SELECT'
|
||||||
'users_privs_db.*': 'SELECT'
|
'users_privs_db.*': 'SELECT'
|
||||||
|
- name: users_privs_usage_only
|
||||||
|
priv:
|
||||||
|
'*.*': 'USAGE'
|
||||||
|
|
||||||
- name: Mysql_info users_privs | Prepare tests users for MariaDB
|
- name: Mysql_info users_privs | Prepare tests users for MariaDB
|
||||||
community.mysql.mysql_user:
|
community.mysql.mysql_user:
|
||||||
|
@ -185,6 +188,7 @@
|
||||||
- users_privs_table
|
- users_privs_table
|
||||||
- users_privs_col
|
- users_privs_col
|
||||||
- users_privs_proc
|
- users_privs_proc
|
||||||
|
- users_privs_usage_only
|
||||||
|
|
||||||
- name: Mysql_info users_privs | Cleanup sql file for the procedure
|
- name: Mysql_info users_privs | Cleanup sql file for the procedure
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
|
|
Loading…
Add table
Reference in a new issue