Skip to content
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

mysql_role: fix and simplify role member detection #368

Conversation

betanummeric
Copy link
Member

@betanummeric betanummeric commented May 23, 2022

bugfix for mysql_role

fixes #366 ("detaching too few members")

Instead of parsing the show grants statement output for each user, query the built-in tables to find out who is member of a role.
MySQL: mysql.role_edges
MariaDB: mysql.roles_mapping

@codecov
Copy link

codecov bot commented May 23, 2022

Codecov Report

Merging #368 (ca6d484) into main (cc950cb) will decrease coverage by 0.23%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #368      +/-   ##
==========================================
- Coverage   78.23%   77.99%   -0.24%     
==========================================
  Files          27       27              
  Lines        2270     2259      -11     
  Branches      551      546       -5     
==========================================
- Hits         1776     1762      -14     
- Misses        335      339       +4     
+ Partials      159      158       -1     
Impacted Files Coverage Δ
plugins/modules/mysql_role.py 85.90% <100.00%> (-1.48%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cc950cb...ca6d484. Read the comment docs.

@betanummeric betanummeric marked this pull request as ready for review May 23, 2022 12:24
@Andersson007
Copy link
Collaborator

@betanummeric thanks for the fix! Could you please add a changelog fragment

Copy link
Collaborator

@Andersson007 Andersson007 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM @betanummeric thanks! Let's make the changelog entries consistent so could you please change it and after that i'll merge the PR.

@Andersson007 Andersson007 merged commit 07a7286 into ansible-collections:main May 25, 2022
@Andersson007
Copy link
Collaborator

@betanummeric thanks for the contribution!

@patchback
Copy link

patchback bot commented May 25, 2022

Backport to stable-2: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-2/07a72865f7ef67017e1acb3d0bf898f8273bcec0/pr-368

Backported as #371

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request May 25, 2022
* mysql_role: fix and simplify role membership detection

* add changelog fragment

* Update changelogs/fragments/368-mysql_role-fix-member-detection.yml

Co-authored-by: Andrew Klychkov <[email protected]>

Co-authored-by: Felix Hamme <[email protected]>
Co-authored-by: Andrew Klychkov <[email protected]>
(cherry picked from commit 07a7286)
Andersson007 pushed a commit that referenced this pull request May 25, 2022
* mysql_role: fix and simplify role membership detection

* add changelog fragment

* Update changelogs/fragments/368-mysql_role-fix-member-detection.yml

Co-authored-by: Andrew Klychkov <[email protected]>

Co-authored-by: Felix Hamme <[email protected]>
Co-authored-by: Andrew Klychkov <[email protected]>
(cherry picked from commit 07a7286)

Co-authored-by: betanummeric <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mysql_role: multiple bugs with detach_members
3 participants