ansible-collections / community.general

Ansible Community General Collection
https://galaxy.ansible.com/ui/repo/published/community/general/
GNU General Public License v3.0
816 stars 1.5k forks source link

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

Closed fgruenbauer closed 3 weeks ago

fgruenbauer commented 4 weeks ago
SUMMARY

The module crashes if an id is provided for a mapper, see https://github.com/ansible-collections/community.general/pull/8695#issuecomment-2331251238.

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

ISSUE TYPE
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
  2. 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 commented 4 weeks ago

cc @eikef @laurpaum @mattock @ndclt @thomasbach-dev click here for bot help

patchback[bot] commented 3 weeks ago

Backport to stable-8: πŸ’š backport PR created

βœ… Backport PR branch: patchback/backports/stable-8/2ae41fa83f44aefce38cd845e377dcdd73b9f32b/pr-8831

Backported as https://github.com/ansible-collections/community.general/pull/8849

πŸ€– @patchback I'm built with octomachinery and my source is open β€” https://github.com/sanitizers/patchback-github-app.

patchback[bot] commented 3 weeks ago

Backport to stable-9: πŸ’š backport PR created

βœ… Backport PR branch: patchback/backports/stable-9/2ae41fa83f44aefce38cd845e377dcdd73b9f32b/pr-8831

Backported as https://github.com/ansible-collections/community.general/pull/8850

πŸ€– @patchback I'm built with octomachinery and my source is open β€” https://github.com/sanitizers/patchback-github-app.

felixfontein commented 3 weeks ago

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