mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-04-28 05:11:26 -07:00
Merge branch 'main' into lie_tests_using_containers
This commit is contained in:
commit
574fef5e50
10 changed files with 73 additions and 16 deletions
11
.github/workflows/ansible-test-plugins.yml
vendored
11
.github/workflows/ansible-test-plugins.yml
vendored
|
@ -25,7 +25,6 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
ansible:
|
ansible:
|
||||||
- stable-2.11
|
|
||||||
- stable-2.12
|
- stable-2.12
|
||||||
- stable-2.13
|
- stable-2.13
|
||||||
- stable-2.14
|
- stable-2.14
|
||||||
|
@ -36,6 +35,7 @@ jobs:
|
||||||
with:
|
with:
|
||||||
ansible-core-version: ${{ matrix.ansible }}
|
ansible-core-version: ${{ matrix.ansible }}
|
||||||
testing-type: sanity
|
testing-type: sanity
|
||||||
|
pull-request-change-detection: true
|
||||||
|
|
||||||
integration:
|
integration:
|
||||||
name: "Integration (Python: ${{ matrix.python }}, Ansible: ${{ matrix.ansible }}, MySQL: ${{ matrix.db_engine_version }}, Connector: ${{ matrix.connector }})"
|
name: "Integration (Python: ${{ matrix.python }}, Ansible: ${{ matrix.ansible }}, MySQL: ${{ matrix.db_engine_version }}, Connector: ${{ matrix.connector }})"
|
||||||
|
@ -51,7 +51,6 @@ jobs:
|
||||||
# also change the "Set MariaDB URL sub dir" task
|
# also change the "Set MariaDB URL sub dir" task
|
||||||
- mariadb_10.8.3
|
- mariadb_10.8.3
|
||||||
ansible:
|
ansible:
|
||||||
- stable-2.11
|
|
||||||
- stable-2.12
|
- stable-2.12
|
||||||
- stable-2.13
|
- stable-2.13
|
||||||
- stable-2.14
|
- stable-2.14
|
||||||
|
@ -77,16 +76,12 @@ jobs:
|
||||||
ansible: stable-2.14
|
ansible: stable-2.14
|
||||||
- python: 3.6
|
- python: 3.6
|
||||||
ansible: devel
|
ansible: devel
|
||||||
- python: 3.8
|
|
||||||
ansible: stable-2.11
|
|
||||||
- python: 3.8
|
- python: 3.8
|
||||||
ansible: stable-2.13
|
ansible: stable-2.13
|
||||||
- python: 3.8
|
- python: 3.8
|
||||||
ansible: stable-2.14
|
ansible: stable-2.14
|
||||||
- python: 3.8
|
- python: 3.8
|
||||||
ansible: devel
|
ansible: devel
|
||||||
- python: 3.9
|
|
||||||
ansible: stable-2.11
|
|
||||||
- python: 3.9
|
- python: 3.9
|
||||||
ansible: stable-2.12
|
ansible: stable-2.12
|
||||||
|
|
||||||
|
@ -143,7 +138,6 @@ jobs:
|
||||||
fail-fast: true
|
fail-fast: true
|
||||||
matrix:
|
matrix:
|
||||||
ansible:
|
ansible:
|
||||||
- stable-2.11
|
|
||||||
- stable-2.12
|
- stable-2.12
|
||||||
- stable-2.13
|
- stable-2.13
|
||||||
- stable-2.14
|
- stable-2.14
|
||||||
|
@ -158,8 +152,6 @@ jobs:
|
||||||
ansible: stable-2.14
|
ansible: stable-2.14
|
||||||
- python: 3.8
|
- python: 3.8
|
||||||
ansible: devel
|
ansible: devel
|
||||||
- python: 3.9
|
|
||||||
ansible: stable-2.11
|
|
||||||
- python: 3.9
|
- python: 3.9
|
||||||
ansible: stable-2.12
|
ansible: stable-2.12
|
||||||
|
|
||||||
|
@ -172,3 +164,4 @@ jobs:
|
||||||
ansible-core-version: ${{ matrix.ansible }}
|
ansible-core-version: ${{ matrix.ansible }}
|
||||||
target-python-version: ${{ matrix.python }}
|
target-python-version: ${{ matrix.python }}
|
||||||
testing-type: units
|
testing-type: units
|
||||||
|
pull-request-change-detection: true
|
||||||
|
|
|
@ -33,6 +33,7 @@ baldpale
|
||||||
banyek
|
banyek
|
||||||
BarbzYHOOL
|
BarbzYHOOL
|
||||||
Berbe
|
Berbe
|
||||||
|
bizmate
|
||||||
bjne
|
bjne
|
||||||
bmalynovytch
|
bmalynovytch
|
||||||
bmildren
|
bmildren
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
minor_changes:
|
||||||
|
- mysql_user - display a more informative invalid privilege exception.
|
||||||
|
Changes the exception handling of the granting permission logic to show the query executed , params
|
||||||
|
and the exception message granting privileges fails` (https://github.com/ansible-collections/community.mysql/issues/465).
|
|
@ -725,7 +725,8 @@ def privileges_grant(cursor, user, host, db_table, priv, tls_requires, maria_rol
|
||||||
try:
|
try:
|
||||||
cursor.execute(query, params)
|
cursor.execute(query, params)
|
||||||
except (mysql_driver.ProgrammingError, mysql_driver.OperationalError, mysql_driver.InternalError) as e:
|
except (mysql_driver.ProgrammingError, mysql_driver.OperationalError, mysql_driver.InternalError) as e:
|
||||||
raise InvalidPrivsError("Error granting privileges, invalid priv string: %s" % priv_string)
|
raise InvalidPrivsError("Error granting privileges, invalid priv string: %s , params: %s, query: %s ,"
|
||||||
|
" exception: %s." % (priv_string, str(params), query, str(e)))
|
||||||
|
|
||||||
|
|
||||||
def convert_priv_dict_to_str(priv):
|
def convert_priv_dict_to_str(priv):
|
||||||
|
|
|
@ -4,3 +4,5 @@
|
||||||
src: installed_file.j2
|
src: installed_file.j2
|
||||||
dest: "{{ dbdeployer_installed_file }}"
|
dest: "{{ dbdeployer_installed_file }}"
|
||||||
listen: create zookeeper installed file
|
listen: create zookeeper installed file
|
||||||
|
tags:
|
||||||
|
- setup_mysql
|
||||||
|
|
|
@ -4,12 +4,24 @@
|
||||||
# and should not be used as examples of how to write Ansible roles #
|
# and should not be used as examples of how to write Ansible roles #
|
||||||
####################################################################
|
####################################################################
|
||||||
|
|
||||||
# - import_tasks: setvars.yml
|
|
||||||
# - import_tasks: dir.yml
|
|
||||||
# - import_tasks: install.yml
|
|
||||||
# - import_tasks: config.yml
|
|
||||||
# - import_tasks: verify.yml
|
|
||||||
|
|
||||||
- name: Prepare the controller python and MySQL connector
|
- name: Prepare the controller python and MySQL connector
|
||||||
ansible.builtin.import_tasks:
|
ansible.builtin.import_tasks:
|
||||||
file: prepare_controller.yml
|
file: prepare_controller.yml
|
||||||
|
tags:
|
||||||
|
- setup_mysql
|
||||||
|
|
||||||
|
# - import_tasks: setvars.yml
|
||||||
|
# tags:
|
||||||
|
# - setup_mysql
|
||||||
|
# - import_tasks: dir.yml
|
||||||
|
# tags:
|
||||||
|
# - setup_mysql
|
||||||
|
# - import_tasks: install.yml
|
||||||
|
# tags:
|
||||||
|
# - setup_mysql
|
||||||
|
# - import_tasks: config.yml
|
||||||
|
# tags:
|
||||||
|
# - setup_mysql
|
||||||
|
# - import_tasks: verify.yml
|
||||||
|
# tags:
|
||||||
|
# - setup_mysql
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
- name: delete temporary directory
|
- name: delete temporary directory
|
||||||
include_tasks: default-cleanup.yml
|
include_tasks: default-cleanup.yml
|
||||||
|
tags:
|
||||||
|
- setup_remote_tmp_dir
|
||||||
|
|
||||||
- name: delete temporary directory (windows)
|
- name: delete temporary directory (windows)
|
||||||
include_tasks: windows-cleanup.yml
|
include_tasks: windows-cleanup.yml
|
||||||
|
tags:
|
||||||
|
- setup_remote_tmp_dir
|
||||||
|
|
|
@ -7,9 +7,13 @@
|
||||||
setup:
|
setup:
|
||||||
gather_subset: distribution
|
gather_subset: distribution
|
||||||
when: ansible_facts == {}
|
when: ansible_facts == {}
|
||||||
|
tags:
|
||||||
|
- setup_remote_tmp_dir
|
||||||
|
|
||||||
- include_tasks: "{{ lookup('first_found', files)}}"
|
- include_tasks: "{{ lookup('first_found', files)}}"
|
||||||
vars:
|
vars:
|
||||||
files:
|
files:
|
||||||
- "{{ ansible_os_family | lower }}.yml"
|
- "{{ ansible_os_family | lower }}.yml"
|
||||||
- "default.yml"
|
- "default.yml"
|
||||||
|
tags:
|
||||||
|
- setup_remote_tmp_dir
|
||||||
|
|
|
@ -281,6 +281,10 @@
|
||||||
- include: test_priv_subtract.yml enable_check_mode=no
|
- include: test_priv_subtract.yml enable_check_mode=no
|
||||||
- include: test_priv_subtract.yml enable_check_mode=yes
|
- include: test_priv_subtract.yml enable_check_mode=yes
|
||||||
|
|
||||||
|
- import_tasks: test_privs_issue_465.yml
|
||||||
|
tags:
|
||||||
|
- issue_465
|
||||||
|
|
||||||
# Tests for the TLS requires dictionary
|
# Tests for the TLS requires dictionary
|
||||||
- include: tls_requirements.yml
|
- include: tls_requirements.yml
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
---
|
||||||
|
# test code for privileges for mysql_user module - issue 465
|
||||||
|
|
||||||
|
- vars:
|
||||||
|
mysql_parameters: &mysql_params
|
||||||
|
login_user: '{{ mysql_user }}'
|
||||||
|
login_password: '{{ mysql_password }}'
|
||||||
|
login_host: 127.0.0.1
|
||||||
|
login_port: '{{ mysql_primary_port }}'
|
||||||
|
|
||||||
|
block:
|
||||||
|
|
||||||
|
# ============================================================
|
||||||
|
- name: create a user with parameters that will always cause an exception
|
||||||
|
mysql_user:
|
||||||
|
<<: *mysql_params
|
||||||
|
name: user_issue_465
|
||||||
|
password: a_test_password_465
|
||||||
|
priv: '*.{{ db_name }}:SELECT'
|
||||||
|
state: present
|
||||||
|
ignore_errors: true
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- name: assert output message for current privileges
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result is failed
|
||||||
|
- result.msg is search('invalid priv string')
|
||||||
|
- result.msg is search('params')
|
||||||
|
- result.msg is search('query')
|
||||||
|
- result.msg is search('exception')
|
Loading…
Add table
Add a link
Reference in a new issue