Fix underlying issue

This commit is contained in:
Andrew Klychkov 2022-03-10 11:31:06 +01:00
commit e0e90b16ed
5 changed files with 7 additions and 13 deletions

View file

@ -119,9 +119,6 @@ jobs:
- name: Set Connector version (${{ matrix.connector }})
run: "sed -i 's/^python_packages:.*/python_packages: [${{ matrix.connector }}]/' ${{ env.connector_version_file }}"
- name: Set Connector type (${{ matrix.connector }})
run: "sed -i 's/^connector_type:.*/connector_type: $(echo ${{ matrix.connector }} | cut -f1 -d'=')/' ${{ env.connector_version_file }}"
- name: Run integration tests
run: ansible-test integration --docker -v --color --retry-on-error --continue-on-error --python ${{ matrix.python }} --diff --coverage
working-directory: ./ansible_collections/community/mysql

View file

@ -398,7 +398,7 @@ def privileges_get(cursor, user, host, maria_role=False):
if not maria_role:
cursor.execute("SHOW GRANTS FOR %s@%s", (user, host))
else:
cursor.execute("SHOW GRANTS FOR %s", (user))
cursor.execute("SHOW GRANTS FOR %s", (user,))
grants = cursor.fetchall()
def pick(x):
@ -618,7 +618,7 @@ def privileges_revoke(cursor, user, host, db_table, priv, grant_option, maria_ro
params = (user, host)
else:
query.append("FROM %s")
params = (user)
params = (user,)
query = ' '.join(query)
cursor.execute(query, params)
@ -644,6 +644,10 @@ def privileges_grant(cursor, user, host, db_table, priv, tls_requires, maria_rol
if 'GRANT' in priv:
query.append("WITH GRANT OPTION")
query = ' '.join(query)
if isinstance(params, str):
params = (params,)
try:
cursor.execute(query, params)
except (mysql_driver.ProgrammingError, mysql_driver.OperationalError, mysql_driver.InternalError) as e:

View file

@ -481,7 +481,7 @@ class MariaDBQueryBuilder():
Returns:
tuple: (query_string, tuple_containing_parameters).
"""
return "SELECT count(*) FROM mysql.user WHERE user = %s AND is_role = 'Y'", (self.name)
return "SELECT count(*) FROM mysql.user WHERE user = %s AND is_role = 'Y'", (self.name,)
def role_grant(self, user):
"""Return a query to grant a role to a user or role.

View file

@ -11,7 +11,6 @@ percona_mysql_packages:
- "{{ percona_client_package }}"
python_packages: [pymysql == 0.9.3]
connector_type: pymysql
install_prereqs:
- libaio1

View file

@ -36,12 +36,6 @@
- meta: end_play
when: srv['version']['major'] < 8
# https://github.com/ansible-collections/community.mysql/issues/292
# FIXME: try to make it working
- name: End play when connector is mysqlclient
meta: end_play
when: connector_type == 'mysqlclient'
#########
# Prepare
- name: Create db {{ test_db }}