forked from ansible-collections/community.mysql
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Display a more informative error when InvalidPrivsError is raised (an…
…sible-collections#465) - continued adding fragment for changelog and fixing sanity errors.
- Loading branch information
Showing
3 changed files
with
59 additions
and
1 deletion.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
changelogs/fragments/465-display_more_informative_invalid_priv_exceptiion.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
and the exception message granting privileges fails` (https://github.com//pull/435). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
tests/integration/targets/test_mysql_user/tasks/test_privs_issue_465.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# test code for privileges for mysql_user module - issue 465 | ||
# (c) 2014, Wayne Rosario <[email protected]> | ||
|
||
# This file is part of Ansible | ||
# | ||
# Ansible is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# Ansible is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
- 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 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 | ||
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' | ||
state: present | ||
register: result | ||
|
||
- name: assert output message for current privileges | ||
assert: | ||
that: | ||
- result is changed |