generated from ansible-collections/collection_template
-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix revoke only grant #503
Merged
Andersson007
merged 3 commits into
ansible-collections:main
from
markuman:fix-revoke-only-grant
Feb 8, 2023
Merged
Fix revoke only grant #503
Andersson007
merged 3 commits into
ansible-collections:main
from
markuman:fix-revoke-only-grant
Feb 8, 2023
Conversation
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
here is a playbook that show the current bug: ---
- name: prepare mariadb container
hosts: localhost
connection: local
tasks:
- name: test
vars:
mysql_parameters: &mysql_params
login_user: root
login_password: mariadb
login_host: 127.0.0.1
login_port: 33066
block:
- name: start nextcloud container
register: out
community.docker.docker_container:
name: mariadb_test_container
image: mariadb:10.6
state: started
auto_remove: true
recreate: true
container_default_behavior: no_defaults
published_ports:
- "127.0.0.1:{{ mysql_parameters.login_port }}:3306"
env:
MARIADB_ROOT_PASSWORD: "{{ mysql_parameters.login_password }}"
- name: mariadb container needs some sec for initialization
pause:
seconds: 10
- name: create user with two grants
mysql_user:
<<: *mysql_params
name: testuser
password: testpassword
update_password: on_create
priv: '*.*:SELECT,GRANT'
- name: >
user must have only one priv. grant priv must be dropped
this is the bug that is fixed in https://github.com/ansible-collections/community.mysql/pull/503
register: result
mysql_user:
<<: *mysql_params
name: testuser
password: testpassword
update_password: on_create
priv: '*.*:SELECT'
- assert:
that:
- result is not failed
- result is changed
- name: immutable - user must have only one priv, grant priv must be dropped
register: result
mysql_user:
<<: *mysql_params
name: testuser
password: testpassword
update_password: on_create
priv: '*.*:SELECT'
- assert:
that:
- result is not failed
- result is not changed
always:
- name: stop mariadb test container
community.docker.docker_container:
name: mariadb_test_container
state: absent it results in
while this PR fixes it
|
Andersson007
approved these changes
Feb 8, 2023
@markuman thanks for the contribution! |
Backport to stable-2: 💚 backport PR created✅ Backport PR branch: Backported as #504 🤖 @patchback |
patchback bot
pushed a commit
that referenced
this pull request
Feb 8, 2023
* fix * test * changelog (cherry picked from commit b34c23d)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SUMMARY
When only
grant
is revoked bymysql_user
, it results in a 2nd sql query, where empty privs are tried to revoked.ISSUE TYPE
COMPONENT NAME
plugs/module_utils/user.py