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

keycloak_client: remove code that turns attributes dict into list #9077

Conversation

fgruenbauer
Copy link
Contributor

SUMMARY

The attribute config item contains a dict with additional settings. The module turns the dict into a list before storing it for the diff/end_state, which turns it into a list of just the keys:

+    "attributes": [
+        "backchannel.logout.revoke.offline.tokens",
+        "backchannel.logout.session.required",
+        "frontchannel.logout.url"
+    ],
+    "baseUrl": "https://www.example.com/",

The actual data sent to the API is not changed, so only --diff/end_state is affected.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

keycloak_client

ADDITIONAL INFORMATION

Create a client with the module with any of the attributes settings from above set and --diff.

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added bug This issue/PR relates to a bug module module plugins plugin (any type) labels Oct 29, 2024
@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-9 Automatically create a backport for the stable-9 branch labels Oct 29, 2024
Copy link
Collaborator

@felixfontein felixfontein left a 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!

@@ -805,9 +805,6 @@ def normalise_cr(clientrep, remove_ids=False):
# Avoid the dict passed in to be modified
clientrep = clientrep.copy()

if 'attributes' in clientrep:
clientrep['attributes'] = list(sorted(clientrep['attributes']))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it possible that this used to be a list, and was changed to a dict at some point?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It kinda looks like it. But i checked Keycloak 5, 9, 13, 18, 25 and its always a dict. Same for the clientscopes.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This was added in #3610 by @pmdumuid. @pmdumuid do you remember why you chose this? The tests added in the PR use Keycloak 12.0.4, maybe that version uses it for whatever reason (even if 9 and 13 do not)?

…turned-into-list.yml

Co-authored-by: Felix Fontein <felix@fontein.de>
@felixfontein felixfontein added the backport-10 Automatically create a backport for the stable-10 branch label Nov 4, 2024
@pmdumuid
Copy link
Contributor

pmdumuid commented Nov 5, 2024 via email

@pmdumuid
Copy link
Contributor

pmdumuid commented Nov 5, 2024 via email

@fgruenbauer
Copy link
Contributor Author

I checked 12.0.4 but its also a dict.

@pmdumuid
Do you have an example client config or just attributes dict that showed incorrect changes in check mode before your changes?

@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Nov 11, 2024
@felixfontein felixfontein merged commit 62cb608 into ansible-collections:main Nov 11, 2024
126 checks passed
Copy link

patchback bot commented Nov 11, 2024

Backport to stable-9: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-9/62cb6087b59064798a51fb90958300827343fdce/pr-9077

Backported as #9115

🤖 @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 Nov 11, 2024
)

* remove code that turns attributes dict into list

* add changelog fragment

* Update changelogs/fragments/9077-keycloak_client-fix-attributes-dict-turned-into-list.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 62cb608)
Copy link

patchback bot commented Nov 11, 2024

Backport to stable-10: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-10/62cb6087b59064798a51fb90958300827343fdce/pr-9077

Backported as #9116

🤖 @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 Nov 11, 2024
)

* remove code that turns attributes dict into list

* add changelog fragment

* Update changelogs/fragments/9077-keycloak_client-fix-attributes-dict-turned-into-list.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 62cb608)
@felixfontein
Copy link
Collaborator

I decided to merge this since currently it seems that the PR is correct, and so that it can go into the 10.0.1 release. Thanks everyone!

felixfontein pushed a commit that referenced this pull request Nov 11, 2024
…that turns attributes dict into list (#9116)

keycloak_client: remove code that turns attributes dict into list (#9077)

* remove code that turns attributes dict into list

* add changelog fragment

* Update changelogs/fragments/9077-keycloak_client-fix-attributes-dict-turned-into-list.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 62cb608)

Co-authored-by: fgruenbauer <gruenbauer@b1-systems.de>
felixfontein pushed a commit that referenced this pull request Nov 11, 2024
…hat turns attributes dict into list (#9115)

keycloak_client: remove code that turns attributes dict into list (#9077)

* remove code that turns attributes dict into list

* add changelog fragment

* Update changelogs/fragments/9077-keycloak_client-fix-attributes-dict-turned-into-list.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 62cb608)

Co-authored-by: fgruenbauer <gruenbauer@b1-systems.de>
Massl123 pushed a commit to Massl123/community.general that referenced this pull request Feb 7, 2025
…sible-collections#9077)

* remove code that turns attributes dict into list

* add changelog fragment

* Update changelogs/fragments/9077-keycloak_client-fix-attributes-dict-turned-into-list.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-9 Automatically create a backport for the stable-9 branch backport-10 Automatically create a backport for the stable-10 branch bug This issue/PR relates to a bug module module plugins plugin (any type)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants