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_realm: fix change detection in check mode by normalizing realms beforehand #8877

Conversation

fgruenbauer
Copy link
Contributor

SUMMARY

The lists enabledEventTypes, otpSupportedApplications and supportedLocales are sorted (in the normalize function) for the diff but not when comparing realms for the changed parameter. So the module always detects a change in check mode but shows an empty diff:

TASK [kc1 - realm-1 - Update Keycloak realm] ************************************************************************************************************************************************************************
changed: [kc1]

To minimize the changes, the lists should be sorted before comparing the realms as well.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

keycloak_realm

ADDITIONAL INFORMATION
  1. create minimal realm:
- name: Create or update Keycloak realm (minimal example)
  community.general.keycloak_realm:
    auth_client_id: admin-cli
    auth_keycloak_url: ...
    auth_realm: master
    auth_username: ...
    auth_password: ...
    id: realm-1
    realm: realm-1
    state: present
    enabledEventTypes:
    - AUTHREQID_TO_TOKEN
    - AUTHREQID_TO_TOKEN_ERROR
    - CLIENT_DELETE
    - CLIENT_DELETE_ERROR
  1. subsequent check runs always detect a change but show an empty diff

@ansibullbot
Copy link
Collaborator

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

If nobody objects, I'll merge this in a week.

@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Sep 23, 2024
@felixfontein felixfontein merged commit deaad6e into ansible-collections:main Sep 23, 2024
147 checks passed
Copy link

patchback bot commented Sep 23, 2024

Backport to stable-8: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-8/deaad6e5479d214da1b762c6166135bcb03d419a/pr-8877

Backported as #8902

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

@felixfontein
Copy link
Collaborator

@fgruenbauer thanks for your contribution!

patchback bot pushed a commit that referenced this pull request Sep 23, 2024
…lms beforehand (#8877)

* keycloak_realm: fix change detection in check mode by normalizing realms beforehand

* add changelog fragment

(cherry picked from commit deaad6e)
Copy link

patchback bot commented Sep 23, 2024

Backport to stable-9: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-9/deaad6e5479d214da1b762c6166135bcb03d419a/pr-8877

Backported as #8903

🤖 @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 Sep 23, 2024
…lms beforehand (#8877)

* keycloak_realm: fix change detection in check mode by normalizing realms beforehand

* add changelog fragment

(cherry picked from commit deaad6e)
felixfontein pushed a commit that referenced this pull request Sep 23, 2024
…ection in check mode by normalizing realms beforehand (#8902)

keycloak_realm: fix change detection in check mode by normalizing realms beforehand (#8877)

* keycloak_realm: fix change detection in check mode by normalizing realms beforehand

* add changelog fragment

(cherry picked from commit deaad6e)

Co-authored-by: fgruenbauer <[email protected]>
felixfontein pushed a commit that referenced this pull request Sep 23, 2024
…ection in check mode by normalizing realms beforehand (#8903)

keycloak_realm: fix change detection in check mode by normalizing realms beforehand (#8877)

* keycloak_realm: fix change detection in check mode by normalizing realms beforehand

* add changelog fragment

(cherry picked from commit deaad6e)

Co-authored-by: fgruenbauer <[email protected]>
aioue pushed a commit to aioue/community.general that referenced this pull request Oct 1, 2024
…lms beforehand (ansible-collections#8877)

* keycloak_realm: fix change detection in check mode by normalizing realms beforehand

* add changelog fragment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8 Automatically create a backport for the stable-8 branch backport-9 Automatically create a backport for the stable-9 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.

3 participants