mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-08-03 04:34:27 -07:00
Display a more informative error when InvalidPrivsError is raised (#465) - fix and add integration test
This commit is contained in:
parent
d42eadb063
commit
222eb60371
6 changed files with 30 additions and 15 deletions
|
@ -4,3 +4,5 @@
|
|||
src: installed_file.j2
|
||||
dest: "{{ dbdeployer_installed_file }}"
|
||||
listen: create zookeeper installed file
|
||||
tags:
|
||||
- setup_mysql
|
||||
|
|
|
@ -5,7 +5,17 @@
|
|||
####################################################################
|
||||
|
||||
- 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
|
||||
include_tasks: default-cleanup.yml
|
||||
tags:
|
||||
- setup_remote_tmp_dir
|
||||
|
||||
- name: delete temporary directory (windows)
|
||||
include_tasks: windows-cleanup.yml
|
||||
tags:
|
||||
- setup_remote_tmp_dir
|
||||
|
|
|
@ -7,9 +7,13 @@
|
|||
setup:
|
||||
gather_subset: distribution
|
||||
when: ansible_facts == {}
|
||||
tags:
|
||||
- setup_remote_tmp_dir
|
||||
|
||||
- include_tasks: "{{ lookup('first_found', files)}}"
|
||||
vars:
|
||||
files:
|
||||
- "{{ ansible_os_family | lower }}.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=yes
|
||||
|
||||
- include: test_privs_issue_465.yml
|
||||
tags:
|
||||
- issue_465
|
||||
|
||||
# Tests for the TLS requires dictionary
|
||||
- include: tls_requirements.yml
|
||||
|
||||
|
|
|
@ -26,28 +26,19 @@
|
|||
block:
|
||||
|
||||
# ============================================================
|
||||
- name: create admin user with ALL privs, without GRANT OPTIONS
|
||||
mysql_user:
|
||||
<<: *mysql_params
|
||||
name: '{{ user_name_1 }}'
|
||||
password: '{{ user_password_1 }}'
|
||||
priv: '*.{{ db_name }}:ALL'
|
||||
state: present
|
||||
|
||||
- include: assert_user.yml user_name={{user_name_2}} priv='ALL'
|
||||
|
||||
- name: create consumer user with all privileges using admin user
|
||||
- name: create a user with parameters that will always cause an exception
|
||||
mysql_user:
|
||||
<<: *mysql_params
|
||||
name: '{{ user_name_2 }}'
|
||||
password: '{{ user_password_2 }}'
|
||||
login_user: '{{ user_name_1 }}'
|
||||
login_password: '{{ user_password_1 }}'
|
||||
priv: '*.{{ db_name }}:ALL'
|
||||
priv: '*.{{ db_name }}:SELECT'
|
||||
state: present
|
||||
ignore_errors: yes
|
||||
register: result
|
||||
|
||||
- name: assert output message for current privileges
|
||||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result is failed
|
||||
- result.msg.find('exception') != -1
|
||||
fail_msg: "Error granting privileges, invalid priv string: SELECT , query: GRANT SELECT ON *.`data` TO %s@%s , exception: (1064, \"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`data` TO 'db_user2'@'localhost'' at line 1\")."
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue