-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 keycloak_client_rolemapping role removal and diff #5619
Fix keycloak_client_rolemapping role removal and diff #5619
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution! Can you please add a changelog fragment? Thanks.
This comment was marked as outdated.
This comment was marked as outdated.
cc194c3
to
c9ac1cf
Compare
Ok, I see, i have to work on unit tests.. |
c9ac1cf
to
7320bd4
Compare
Keycloak's delete_group_rolemapping API wrapper didn't pass data about the roles to remove to keycloak, resulting in removal of all roles. Follow the intended behaviour and delete only the roles listed in the module invocation. Signed-off-by: Florian Achleitner <flo@fopen.at>
The module's diff output wrongly showed the changed roles list as 'after' state. This is obviously wrong for role removal and also wrong for role addition, if there are other roles assigned. Use the result of the API query for 'end_state' for 'diff' as well. Signed-off-by: Florian Achleitner <flo@fopen.at>
Signed-off-by: Florian Achleitner <flo@fopen.at>
Signed-off-by: Florian Achleitner <flo@fopen.at> Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Felix Fontein <felix@fontein.de>
bf59c8a
to
2801b70
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I can judge it it looks good. I will merge for the release on Tuesday if nobody objects.
Backport to stable-5: 💚 backport PR created✅ Backport PR branch: Backported as #5655 🤖 @patchback |
* Keycloak: Fix client rolemapping removal Keycloak's delete_group_rolemapping API wrapper didn't pass data about the roles to remove to keycloak, resulting in removal of all roles. Follow the intended behaviour and delete only the roles listed in the module invocation. Signed-off-by: Florian Achleitner <flo@fopen.at> * Keycloak: Fix client_rolemapping diff The module's diff output wrongly showed the changed roles list as 'after' state. This is obviously wrong for role removal and also wrong for role addition, if there are other roles assigned. Use the result of the API query for 'end_state' for 'diff' as well. Signed-off-by: Florian Achleitner <flo@fopen.at> * Keycloak: Calculate client_rolemapping proposed state properly Signed-off-by: Florian Achleitner <flo@fopen.at> * Add changelog fragment Signed-off-by: Florian Achleitner <flo@fopen.at> Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Felix Fontein <felix@fontein.de> * Fix for python2 unit test Signed-off-by: Florian Achleitner <flo@fopen.at> Co-authored-by: Felix Fontein <felix@fontein.de> (cherry picked from commit f0b3bba)
Backport to stable-6: 💚 backport PR created✅ Backport PR branch: Backported as #5656 🤖 @patchback |
@flyingflo thanks for your contribution! |
* Keycloak: Fix client rolemapping removal Keycloak's delete_group_rolemapping API wrapper didn't pass data about the roles to remove to keycloak, resulting in removal of all roles. Follow the intended behaviour and delete only the roles listed in the module invocation. Signed-off-by: Florian Achleitner <flo@fopen.at> * Keycloak: Fix client_rolemapping diff The module's diff output wrongly showed the changed roles list as 'after' state. This is obviously wrong for role removal and also wrong for role addition, if there are other roles assigned. Use the result of the API query for 'end_state' for 'diff' as well. Signed-off-by: Florian Achleitner <flo@fopen.at> * Keycloak: Calculate client_rolemapping proposed state properly Signed-off-by: Florian Achleitner <flo@fopen.at> * Add changelog fragment Signed-off-by: Florian Achleitner <flo@fopen.at> Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Felix Fontein <felix@fontein.de> * Fix for python2 unit test Signed-off-by: Florian Achleitner <flo@fopen.at> Co-authored-by: Felix Fontein <felix@fontein.de> (cherry picked from commit f0b3bba)
Docs Build 📝Thank you for contribution!✨ This PR has been merged and your docs changes will be incorporated when they are next published. |
…g role removal and diff (#5656) Fix keycloak_client_rolemapping role removal and diff (#5619) * Keycloak: Fix client rolemapping removal Keycloak's delete_group_rolemapping API wrapper didn't pass data about the roles to remove to keycloak, resulting in removal of all roles. Follow the intended behaviour and delete only the roles listed in the module invocation. Signed-off-by: Florian Achleitner <flo@fopen.at> * Keycloak: Fix client_rolemapping diff The module's diff output wrongly showed the changed roles list as 'after' state. This is obviously wrong for role removal and also wrong for role addition, if there are other roles assigned. Use the result of the API query for 'end_state' for 'diff' as well. Signed-off-by: Florian Achleitner <flo@fopen.at> * Keycloak: Calculate client_rolemapping proposed state properly Signed-off-by: Florian Achleitner <flo@fopen.at> * Add changelog fragment Signed-off-by: Florian Achleitner <flo@fopen.at> Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Felix Fontein <felix@fontein.de> * Fix for python2 unit test Signed-off-by: Florian Achleitner <flo@fopen.at> Co-authored-by: Felix Fontein <felix@fontein.de> (cherry picked from commit f0b3bba) Co-authored-by: fachleitner <flo@fopen.at>
…g role removal and diff (#5655) Fix keycloak_client_rolemapping role removal and diff (#5619) * Keycloak: Fix client rolemapping removal Keycloak's delete_group_rolemapping API wrapper didn't pass data about the roles to remove to keycloak, resulting in removal of all roles. Follow the intended behaviour and delete only the roles listed in the module invocation. Signed-off-by: Florian Achleitner <flo@fopen.at> * Keycloak: Fix client_rolemapping diff The module's diff output wrongly showed the changed roles list as 'after' state. This is obviously wrong for role removal and also wrong for role addition, if there are other roles assigned. Use the result of the API query for 'end_state' for 'diff' as well. Signed-off-by: Florian Achleitner <flo@fopen.at> * Keycloak: Calculate client_rolemapping proposed state properly Signed-off-by: Florian Achleitner <flo@fopen.at> * Add changelog fragment Signed-off-by: Florian Achleitner <flo@fopen.at> Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Felix Fontein <felix@fontein.de> * Fix for python2 unit test Signed-off-by: Florian Achleitner <flo@fopen.at> Co-authored-by: Felix Fontein <felix@fontein.de> (cherry picked from commit f0b3bba) Co-authored-by: fachleitner <flo@fopen.at>
SUMMARY
community.general.keycloak_client_rolemapping with
state: absent
removes allroles. The intention is to only remove those listed.
The diff returned by the module has a
before
andafter
list. The latter contained thechanged roles, instead of the roles after the change.
ISSUE TYPE
COMPONENT NAME
community.general.keycloak_client_rolemapping
ADDITIONAL INFORMATION
Fix these two issues.