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_user_federation: get the before mappers from before_comp to fix UnboundLocalError #8831

Conversation

fgruenbauer
Copy link
Contributor

SUMMARY

The module crashes if an id is provided for a mapper, see #8695 (comment).

The before mappers should be retrieved from the before_comp not before_mapper.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

community.general.keycloak_user_federation

ADDITIONAL INFORMATION
  1. create a mapper without providing an id:
mappers:
  - name: "first name"
    providerId: "user-attribute-ldap-mapper"
    providerType: "org.keycloak.storage.ldap.mappers.LDAPStorageMapper"
    config:
      ldap.attribute: givenName
      read.only: true
      write.only: false
      attribute.force.default: true
      is.mandatory.in.ldap: true
      is.binary.attribute: false
      user.model.attribute: firstName
  1. copy id from keycloak and update mapper:
mappers:
  - name: "first name"
    id: f2d82dec-923c-40da-a9f7-0fe83ca8c009
    providerId: "user-attribute-ldap-mapper"
    providerType: "org.keycloak.storage.ldap.mappers.LDAPStorageMapper"
    config:
      ldap.attribute: givenName
      read.only: true
      write.only: false
      attribute.force.default: true
      is.mandatory.in.ldap: true
      is.binary.attribute: false
      user.model.attribute: firstName

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added WIP Work in progress bug This issue/PR relates to a bug module module plugins plugin (any type) small_patch Hopefully easy to review labels Sep 5, 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 5, 2024
@ansibullbot ansibullbot removed the small_patch Hopefully easy to review label Sep 9, 2024
@fgruenbauer fgruenbauer marked this pull request as ready for review September 9, 2024 09:18
@ansibullbot ansibullbot removed the WIP Work in progress label Sep 9, 2024
@felixfontein felixfontein merged commit 2ae41fa into ansible-collections:main Sep 9, 2024
147 checks passed
Copy link

patchback bot commented Sep 9, 2024

Backport to stable-8: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-8/2ae41fa83f44aefce38cd845e377dcdd73b9f32b/pr-8831

Backported as #8849

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

@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Sep 9, 2024
patchback bot pushed a commit that referenced this pull request Sep 9, 2024
…o fix `UnboundLocalError` (#8831)

* fix: get the before mappers from `before_comp`

* add changelog fragment

* Adjust changelog fragment.

---------

Co-authored-by: Felix Fontein <[email protected]>
(cherry picked from commit 2ae41fa)
Copy link

patchback bot commented Sep 9, 2024

Backport to stable-9: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-9/2ae41fa83f44aefce38cd845e377dcdd73b9f32b/pr-8831

Backported as #8850

🤖 @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 9, 2024
…o fix `UnboundLocalError` (#8831)

* fix: get the before mappers from `before_comp`

* add changelog fragment

* Adjust changelog fragment.

---------

Co-authored-by: Felix Fontein <[email protected]>
(cherry picked from commit 2ae41fa)
@felixfontein
Copy link
Collaborator

@fgruenbauer thanks for your contribution!
@uejo thanks for checking this out and reporting the bug!

felixfontein pushed a commit that referenced this pull request Sep 9, 2024
…the before mappers from `before_comp` to fix `UnboundLocalError` (#8849)

keycloak_user_federation: get the before mappers from `before_comp` to fix `UnboundLocalError` (#8831)

* fix: get the before mappers from `before_comp`

* add changelog fragment

* Adjust changelog fragment.

---------

Co-authored-by: Felix Fontein <[email protected]>
(cherry picked from commit 2ae41fa)

Co-authored-by: fgruenbauer <[email protected]>
felixfontein pushed a commit that referenced this pull request Sep 9, 2024
…the before mappers from `before_comp` to fix `UnboundLocalError` (#8850)

keycloak_user_federation: get the before mappers from `before_comp` to fix `UnboundLocalError` (#8831)

* fix: get the before mappers from `before_comp`

* add changelog fragment

* Adjust changelog fragment.

---------

Co-authored-by: Felix Fontein <[email protected]>
(cherry picked from commit 2ae41fa)

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

* fix: get the before mappers from `before_comp`

* add changelog fragment

* Adjust changelog fragment.

---------

Co-authored-by: Felix Fontein <[email protected]>
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